从ACAccount创建FBSDKAccessToken

时间:2015-12-15 01:01:23

标签: ios facebook parse-platform acaccount acaccountstore

我正在使用Facebook iOS SDK的import matplotlib as mpl def return_bokeh_colormap(name): cm = mpl.cm.get_cmap(name) colormap = [rgb_to_hex(tuple((np.array(cm(x))*255).astype(np.int))) for x in range(0,cm.N)] return colormap def rgb_to_hex(rgb): return '#%02x%02x%02x' % rgb[0:3] 并为v4.8进行开发。我也在使用Parse框架的iOS 8+

我想通过v1.11.0& amp; ACAccount个班级。登录工作完美,但在我获得访问权限后,我需要将ACAccountStore转换为ACAccount才能登录Parse框架:

这是我的Swift代码:

FBSDKAccessToken

我收到此错误:let accountStore = ACAccountStore() let socialAccount = accountStore.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierFacebook) let appID = NSBundle.mainBundle().infoDictionary?["FacebookAppID"] as? String ?? "" let permissions = ["user_birthday", "user_relationships", "user_location", "user_about_me"] accountStore.requestAccessToAccountsWithType(socialAccount, options: [ACFacebookAppIdKey: appID, ACFacebookPermissionsKey: permissions]) { (granted: Bool, error: NSError!) in var token: FBSDKAccessToken? = nil if let socialAccount = accountStore.accountsWithAccountType(socialAccount).last as? ACAccount, let userID = socialAccount.username where granted { token = FBSDKAccessToken(tokenString: socialAccount.credential.oauthToken, permissions: permissions, declinedPermissions: nil, appID: appID, userID: userID, expirationDate: NSDate.distantFuture(), refreshDate: NSDate.distantFuture()) } if let token = token { print("token \(token.tokenString) \(token.permissions) \(token.appID) \(token.userID) \(token.expirationDate) \(token.refreshDate)") PFFacebookUtils.logInInBackgroundWithAccessToken(token, block: nil) } }

我做错了什么?

0 个答案:

没有答案