Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter integration with parse in iOS getting error 1012

I have been fighting this for some time, and not able to narrow down the problem. I am using parse twitter integration, but get the following error (I have already checked all the topics regarding the following error message):

Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x98ead30 {NSErrorFailingURLKey=https://api.twitter.com/oauth/request_token, NSErrorFailingURLStringKey=https://api.twitter.com/oauth/request_token, NSUnderlyingError=0x98cd1c0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"}

I have specified a callback url for my app in the twitter settings, and set read & write permission for the application (checked the allow twitter sign in option as well). I have tested the https://api.twitter.com/oauth/request_token from the simulator and can open it (taught it is a network issue at first). I am testing parse and this is a bit of show stopper for me. Here is my code:

in didFinishWithOptions:

[PFTwitterUtils initializeWithConsumerKey:@"appkey" consumerSecret:@"appsecret"];

and my twitter button action:

[PFTwitterUtils logInWithBlock:^(PFUser *user, NSError *error) {

NSLog(@"%@",error);

if (!user) {

NSLog(@"%@", user);

NSLog(@"Uh oh. The user cancelled the Twitter login.");

return;

} else if (user.isNew) {

NSLog(@"User signed up and logged in with Twitter!");

} else {

NSLog(@"User logged in with Twitter!");

}

}];

I am using the latest version of the SDK. Does anyone have any idea what might be the problem?

Thank you in advance!

like image 912
knikolov Avatar asked Dec 12 '25 11:12

knikolov


2 Answers

I had recently worked with twitter integration into parse.com, first you need to set up twitter app on devs.twitter.com then copy the consumer keys into parse.com> your app> settings > user authentication , make sure to enable twitter authorisation(which is enabled by default). While initialising PFTwitter utils make sure to pass you twitter app key and consumer secret ,and this allows you to use twitter login/signup.

like image 177
savana Avatar answered Dec 15 '25 01:12

savana


Make sure that within the developer area for your application on Twitter, under the Settings tab, that you have specified a Callback URL. Even if you are not using this field, Parse requires the usage of it because their codebase still contains code related to Twitter OAuth 1.0a. Fill in anything you'd like in order to make it work.

like image 31
Ross Avatar answered Dec 15 '25 00:12

Ross



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!