简体   繁体   中英

facebook sdk 3.1.1 login settings

I am trying to integrate facebook sdk 3.1.1 with iOS6. My issue is if the user has "logged in" in settings it works fine, but if the user has not logged in, the facebook sdk gives option for go to "Settings" and log in there, but it does not go to settings, then I went through some forums, there I came to know that this code does not work

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Network"]];

and may be that's why its not opening the settings I am using this code to post

      BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self
                                                                    initialText:@"message"
                                                                          image:nil
                                                                            url:nil
                                                                        handler:nil];
    if (!displayedNativeDialog) {

        [self performPublishAction:^{
            // otherwise fall back on a request for permissions and a direct post
            [FBRequestConnection startForPostStatusUpdate:@""
                                        completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

                                            [self showAlert:message result:result error:error];
                                        }];

        }];
    }
- (void) performPublishAction:(void (^)(void)) action {

if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound) {

    [FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
                                               defaultAudience:FBSessionDefaultAudienceFriends
                                             completionHandler:^(FBSession *session, NSError *error) {
                                                 if (!error) {
                                                     action();
                                                 }

                                             }];
} else {
    action();
}

}

Possible solutions ????

I dint know or found any documentation that there is also facebook appid under Project > Target > Info > URL Types > URL Schemes besides plist

in my case it was not there but in sample projects from facebook it was there, I inserted the appid with appID and it worked perfectly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM