Objective-c: Twitter login failed on iPad: Whoa there

enter image description here I used the classic Twitter project Twitter Open Source to create Twitter for the iPad.

My code to instantiate the mechanism and display the input controller:

if (!_engine) { _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self]; [_engine setConsumerKey:@"kConsumerKey"]; [_engine setConsumerSecret:@"kConsumerSecret"]; } if (![_engine isAuthorized]){ UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self]; if (controller){ if ([controller respondsToSelector:@selector(setModalPresentationStyle:)] == YES) { controller.modalPresentationStyle = UIModalPresentationFormSheet; } [self presentModalViewController:controller animated:YES]; return; } } 

In addition, I set the URLS for SA_OAuthTwitterEngine in https:

 self.requestTokenURL = [NSURL URLWithString: @"https://twitter.com/oauth/request_token"]; self.accessTokenURL = [NSURL URLWithString: @"https://twitter.com/oauth/access_token"]; self.authorizeURL = [NSURL URLWithString: @"https://twitter.com/oauth/authorize"]; 

and my TWITTER_DOMAIN in MGTwitterEngine.m has been changed to:

 #define TWITTER_DOMAIN @"api.twitter.com/1" 

Running this code in a simulator for iPhone and iPad works like a charm. HOWEVER, whenever I test this code on an iPad, I selected this error:

Be there! The request token for this page is invalid. It may have already been used or expired because it is too old. Please return to the site or application that sent you here and try again; it was probably just a mistake

(screenshot attached).

Any suggestions on how to get a standard login screen are welcome.

+4
source share
2 answers

I had the same problem and tried to use Jeff's method. That didn't work either. For an unknown reason, check the time settings and set to set the time automatically. It worked for me.

+2
source

I ran into the same problem. It happens that the request does not receive the request token. You can explicitly call it:

 SA_OAuthTwitterEngine *myEngine; [myEngine requestRequestToken]; 

Hope this helps!

+1
source

Source: https://habr.com/ru/post/1388888/


All Articles