Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

facebook ios sdk - First dialog after authenticating fails immediately and closes dialog

I'm using the latest Facebook SDK on iOS 5. I can use SSO to successfully authenticate the user, and then I attempt to share a link like this:

NSString *appId = [[[NSBundle mainBundle] infoDictionary] 
                                          objectForKey:TSFacebookAppID];

NSMutableDictionary* params = 
[NSMutableDictionary dictionaryWithObjectsAndKeys:
                          appId,                @"app_id",
                          [url absoluteString], @"link
                          title,                @"caption",
                          body,                 @"description",
                          nil];

[facebook dialog:@"feed" andParams:params andDelegate:self];

The first time I attempt this, the dialog appears and immediately closes, calling the dialog:didFailWithError:error delegate method. The error is:

Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x98f2ab0 {NSErrorFailingURLKey=https://m.facebook.com/dialog/feed?link=http%3A%2F%2Fwww.thescore.com%2Fhome%2Farticles%2F184248&description=Nadal%20pulls%20out%20of%20Paris%20to%20focus%20on%20ATP%20finals&access_token=BAABw00HZB06cBALT57lZCM24N4EOtPpOQeCgl7oLUvbHFR0ZAlwgAbPHQ7HANmlBE0aUKVNDmWNYsEqB0wXq28vm4D18T5hLTVDK3x2WjnVjgIVl75RPoOszSB21f4ZD&caption=Article%20from%20ScoreMobile%20for%20iPhone&app_id=124052647629735&redirect_uri=fbconnect%3A%2F%2Fsuccess&sdk=2&display=touch, NSErrorFailingURLStringKey=https://m.facebook.com/dialog/feed?link=http%3A%2F%2Fwww.thescore.com%2Fhome%2Farticles%2F184248&description=Nadal%20pulls%20out%20of%20Paris%20to%20focus%20on%20ATP%20finals&access_token=BAABw00HZB06cBALT57lZCM24N4EOtPpOQeCgl7oLUvbHFR0ZAlwgAbPHQ7HANmlBE0aUKVNDmWNYsEqB0wXq28vm4D18T5hLTVDK3x2WjnVjgIVl75RPoOszSB21f4ZD&caption=Article%20from%20ScoreMobile%20for%20iPhone&app_id=124052647629735&redirect_uri=fbconnect%3A%2F%2Fsuccess&sdk=2&display=touch}

However, subsequent attempts to share the link work fine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just an update for everyone, it's finally assigned to somebody at Facebook: https://developers.facebook.com/bugs/168127053284477 - hopefully it will be fixed soon.

Meanwhile, somebody sent a pull request on github with a fix: https://github.com/facebook/facebook-ios-sdk/pull/436

Hope it helps someone, as I was still facing the same bug..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...