Wednesday, March 23, 2016

Instagram iOS API Error Domain=WebKitErrorDomain Code=102 “Frame load interrupted”

Leave a Comment

I am working on a project for iPhone where I have to take images from Instagram. I implemented the following API as mentioned on its developer site:

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code

When I hit this URL in my UIWebview I get the following error:

Error Domain=WebKitErrorDomain Code=102 "Frame load interrupted"

But when I hit the same URL in the device browser it works. But it modifies the URL to be:

https://www.instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=token&scope=SCOPE

I also tried to put this modified URL in my code. Then it works and asks me to log in. But when I log in I get this error.

{     "code": 400,     "error_type": "OAuthException",     "error_message": "You must include a valid client_id, response_type, and redirect_uri parameters" } 

I recently created a client ID and checked all parameters. So I'm not sure what the issue is. I googled it and found that UIWebView doesnt allow this. So I put this in didFinishLaunching in my AppDelegate class:

NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3", @"UserAgent", nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; 

But this is also not working. Please advise for any solution regarding this.

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment