0

I am attempting to allow users of my iOS app to choose a picture form their Facebook pictures with a graph API call. I do this by querying for the album IDs then by searching through those albums. The album query works. However, if I close to app completely (by deleting it from currently open apps), I can no longer make the call. If I just close the app and re-open it, it works fine. This only happens when I completely close the app. Is there a way around this?

Here is the code I use to make the call to get albums:

[FBRequestConnection startWithGraphPath:@"me/albums"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                          if (!error) {
                              NSLog(@"Results: %@", result);
                          }
                      }
 ];

Again, the issue is that when I close the app, double-click the home button, and completely close my app, then re-open it, this call does not work. Thanks in advance.

4

1 回答 1

0

也许您的 Facebook 会话已关闭。尝试在应用打开时添加此行:

if (!FBSession.activeSession.isOpen) {
    [FBSession.activeSession openWithCompletionHandler:^(FBSession *session,
                                                         FBSessionState state,
                                                         NSError *error) {
      // perform action that you want to happen when FB session opens like a segue
    }];
}

有关会话的更多信息,请访问https://developers.facebook.com/docs/ios/session/

于 2013-08-29T02:28:27.297 回答