How long have you updated facebook API? About two weeks ago, I had to remove the entire API, download and modify all the publishing code that my application used. He stopped working completely and had no idea until application users complained. Some necessary changes for the new facebook API:
Facebook recommends putting them in your appDelegate if you look at the latest sample applications.
#import <FacebookSDK/FacebookSDK.h> - (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI { NSArray *permissions = [NSArray arrayWithObjects:@"publish_actions", nil]; return [FBSession openActiveSessionWithPermissions:permissions allowLoginUI:allowLoginUI completionHandler:^(FBSession *session, FBSessionState state, NSError *error) { if(state==513){ //facebook usage has been approved } }]; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { // We need to handle URLs by passing them to FBSession in order for SSO authentication // to work. return [FBSession.activeSession handleOpenURL:url]; }
And if you want to make your post, do something like this:
if(facebookEnabled==YES) { NSString *fbText=[NSString stringWithFormat:@"whatever text you want to post"; [FBRequestConnection startForPostStatusUpdate:fbText completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { }]; }
Let me know if you have any questions. Hope this helps!
source share