I’m trying to post a message to the users wall in out iOS app. The first time the user attempts to do this, the app switches to the Facebook app so they can sign in and accept our app. It then automatically goes back to our app as excepted. It then opens a UIWebView dialog (so the user can post their message to their wall), however an error message is shown in the dialog instead, saying “An error has occurred. Please try again later.” Subsequent attempts to post the message work as expected, the issue only seems to occur immediately after signing in or accepting our app on Facebook.
Furthermore, when the error is shown, and the user clicks okay to dismiss the dialog, it then loads the user’s wall showing all their friends posts, rather than closing the dialog.
Anybody know any solutions to this issue? I am working off the latest SDK.
Here is the code I use to login and display the dialog.
Authenciating session:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"]
&& [defaults objectForKey:@"FBExpirationDateKey"]) {
facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}
if (![facebook isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:
nil];
[facebook authorize:permissions];
[permissions release];
return NO;
}
return YES;
And the code to show the dialog:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"app_id",
link, @"link",
imageURL, @"picture",
linkName, @"name",
caption, @"caption",
description, @"description",
nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
Solved the issue by just making a separate call after it returns back to our app.