我一直在尝试使用 Facebook 开发 iOS 应用程序,但我是新手。所以我一直在努力让
使用 Facebook 登录,按照 Facebook 上的教程并尝试实现它。
但我遇到过,[FBSession sessionOpenWithPermissions]
未找到。当我运行
应用程序,它将强制关闭并提示错误。构建项目时,会出现警告
黄色感叹号sessionOpenWithPermission
未找到于FBSession
教程过时了吗?如果是,那么新的 Facebook SDK 的新代码是什么?
会话OpenWithPermission ?
试试这个代码
account = [[ACAccountStore alloc] init];
accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
arrayOfAccounts = [account accountsWithAccountType:accountType];
appDelegate= (AppDelegate *)[[UIApplication sharedApplication] delegate];
chk=appDelegate.chk_login;
if (!appDelegate.session.isOpen) {
// create a fresh session object
appDelegate.session = [[FBSession alloc] init];
if (appDelegate.session.state == FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[appDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// we recurse here, in order to update buttons and labels
}];
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)