问题
I've got an iOS app with the Facebook SDK. I'm using the first block of sample code at https://developers.facebook.com/docs/ios/ios-sdk-games/feed/ almost verbatim to share info from my app to FB. I've only changed strings and URLs from the sample code to fit my app.
While posts from my app do appear on my Facebook wall and everything looks good, the FBAppCall results in my NSLog
are saying,
Error publishing story = Error Domain=com.facebook.sdk Code=11 "The user navigated away from the Facebook app prior to completing this AppCall. This AppCall is now cancelled and needs to be retried to get a successful completion
I'm trying to use the FBAppCall results so that upon a successful send, I can trigger another network call to my backend where I can record data about the event. Oddly, while I can see the posts on my wall, the final else
condition of "Story Published" is not occurring, the error
condition is.
Here's the actual FBAppCall that again comes right from https://developers.facebook.com/docs/ios/ios-sdk-games/feed/
[FBDialogs presentShareDialogWithParams:shareParams
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(@"Error publishing story = %@.", error);
NSLog(@"result = %@.", results);
} else if (results[@"completionGesture"] && [results[@"completionGesture"] isEqualToString:@"cancel"]) {
NSLog(@"User canceled story publishing.");
} else {
NSLog(@"Story published.");
self.shareMethod = @"Facebook";
[self recordSharingDataAtParse:self.shareMethod];
}
}];
One last note: I don't believe it could be the cause, but my FB app is in "sandbox" mode currently.
Update: I found this similar post FBDialogs presentShareDialogWithParams succeeds but error gets returned with recommended resolution of disabling "Install Insights" & "Mobile SDK Insights" in the app console. Unfortunately that did not resolve my issue.
Thanks.
回答1:
I am not sure about Error Domain=com.facebook.sdk Code=11
but you have to check your app setting on facebook and some Migrations disable last three options(July 2012, August 2012 Breaking Changes).
:)
回答2:
When you encounter this error, you will need to handle the response from your app delegate.
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
fallbackHandler:^(FBAppCall *call) {
if (call.appLinkData && call.appLinkData.targetURL) {
// Invoke pending callback.
}
}];
}
When the user completes the action, the call would contain all the information from the post:
<FBAppCall: 0x147274f0, ID: 62FA2382-B557-45D5-8ACA-FE4C7516F861
dialogData: <FBDialogsData: 0x14727490, method: share
arguments: {
dataFailuresFatal = 0;
description = "After years of captivity, Angry Goat is finally free!";
link = "http://appstore.com/berrycrush";
name = "Unlocked Angry Goat";
picture = "http://example.com/angry-goat.png";
}
results: {
completionGesture = post;
didComplete = 1;
}>
>
来源:https://stackoverflow.com/questions/20259829/presentsharedialogwithparams-posts-to-fb-wall-but-callback-handler-results-say