使用Swift中的Facebook SDK v4
和ParseHelperv4
将图片发布到FB。
创建用户并使用读取柿子登录,我可以获得用户信息,如邮件名称等,对于FBSDKAccessToken.currentAccessToken()
,它始终为空,因此来自FBSDKSharingDelegate
的响应始终是您没有权限。 ......我做错了吗?
let permissions : NSArray = ["publish_actions"]
PFFacebookUtils.linkUserInBackground(PFUser.currentUser(), withPublishPermissions: permissions, block: { (aBool, error) -> Void in
if aBool && error == nil {
let aToken = FBSDKAccessToken.currentAccessToken()
println(aToken.permissions) -- just for logging and it returns empty not even read permissions
let fbPhoto = FBSDKSharePhoto(image: self.topImageView.image, userGenerated: true)
let aTest : FBSDKSharePhotoContent = FBSDKSharePhotoContent()
aTest.photos = [fbPhoto]
FBSDKShareAPI.shareWithContent(aTest, delegate: self) }
})
和委托
func sharer(sharer: FBSDKSharing!, didFailWithError error: NSError!) {
println(error.description)
}
错误Domain = com.facebook.sdk.share Code = 202"操作无法执行 完成。 (com.facebook.sdk.share error 202。)"的UserInfo = 0x16535010 {com.facebook.sdk:FBSDKErrorDeveloperMessageKey =共享API不是 可用。 [FBSDKAccessToken currentAccessToken]必须有 publish_actions权限。}
我可能错过了一步......我应该以某种方式将fbaccestoken设置为与pffaceookutils链接?