1
我正在嘗試將facebook sdk 3.1.1與iOS6集成。我的問題是,如果用戶已在設置中「登錄」,它的工作正常,但如果用戶還沒有登錄,facebook sdk提供了轉到「設置」並登錄的選項,但它不會轉到設置,然後,我通過一些論壇去了,在那裏我才知道,這個代碼不起作用facebook sdk 3.1.1登錄設置
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Network"]];
,並可能這就是爲什麼它不打開設置 我使用這個代碼後
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();
}
}
可能的解決方案 ????