【问题标题】:Can't post OpenGraph story: OAuthException, An unknown error has occurred, Test user无法发布 OpenGraph 故事:OAuthException,发生未知错误,测试用户
【发布时间】:2017-02-02 20:46:03
【问题描述】:

我正在尝试将 OpenGraph 故事发布到 Facebook。 publish_actions 尚未获得批准(也未提交批准),但我正在使用该应用程序的测试用户,所以它应该可以工作。这是我的代码:

let loginManager: FBSDKLoginManager = FBSDKLoginManager()
loginManager.logInWithPublishPermissions(["publish_actions"], fromViewController: self, handler: { (result, error) in

    if error != nil
    {
        self.postOnFacebookSwitch.on = false
    }
    else
    {
        self.postOpenGraphStoryToFacebook()
    }
})

func postOpenGraphStoryToFacebook()
{
    NSLog("postOpenGraphStoryToFacebook()")            

    let object = FBSDKShareOpenGraphObject(properties: ["og:type": "location", "og:title": "test location title", "place:location:latitude": 12.2, "place:location:longitude": 13.2])

    let action = FBSDKShareOpenGraphAction()
    action.actionType = "testapp:check_in"
    action.setObject(object, forKey: "location")

    let content = FBSDKShareOpenGraphContent()
    content.action = action
    content.previewPropertyName = "location"

    let shareAPI = FBSDKShareAPI()
    shareAPI.delegate = self
    shareAPI.shareContent = content
    shareAPI.share()
}

这是完整的日志:

2016-09-25 15:45:24.568 TestApp[72327:19648100] postOpenGraphStoryToFacebook()
2016-09-25 15:45:24.848 TestApp[72327:19648100] didFailWithError Error Domain=com.facebook.sdk.share Code=201 "(null)" UserInfo={NSUnderlyingError=0x8287e6a0 {Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown error has occurred., NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter: 0x8287bb30>, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=1, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=1, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey=<CFBasicHash 0x8287f190 [0x3c7b1f8]>{type = mutable dict, count = 2,
entries =>
    1 : <CFString 0x82880450 [0x3c7b1f8]>{contents = "code"} = <CFNumber 0x796da9b0 [0x3c7b1f8]>{value = +500, type = kCFNumberSInt64Type}
    2 : <CFString 0x8f55ac [0x3c7b1f8]>{contents = "body"} = <CFBasicHash 0x8287e130 [0x3c7b1f8]>{type = immutable dict, count = 1,
entries =>
    2 : <CFString 0x8287e750 [0x3c7b1f8]>{contents = "error"} = <CFBasicHash 0x8287cc10 [0x3c7b1f8]>{type = immutable dict, count = 4,
entries =>
    0 : <CFString 0x8282aae0 [0x3c7b1f8]>{contents = "type"} = <CFString 0x8287a510 [0x3c7b1f8]>{contents = "OAuthException"}
    1 : <CFString 0x8287def0 [0x3c7b1f8]>{contents = "code"} = <CFNumber 0x7a906b70 [0x3c7b1f8]>{value = +1, type = kCFNumberSInt32Type}
    3 : <CFString 0x8287fdd0 [0x3c7b1f8]>{contents = "fbtrace_id"} = <CFString 0x8287f970 [0x3c7b1f8]>{contents = "C0APfOSCSX9"}
    5 : <CFString 0x8287db10 [0x3c7b1f8]>{contents = "message"} = <CFString 0x8287ba00 [0x3c7b1f8]>{contents = "An unknown error has occurred."}
}

}

}
, NSLocalizedRecoveryOptions=(
    OK
), NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again.}}, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Error creating Open Graph object: Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown error has occurred., NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter: 0x8287bb30>, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=1, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=1, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey=<CFBasicHash 0x8287f190 [0x3c7b1f8]>{type = mutable dict, count = 2,
entries =>
    1 : <CFString 0x82880450 [0x3c7b1f8]>{contents = "code"} = <CFNumber 0x796da9b0 [0x3c7b1f8]>{value = +500, type = kCFNumberSInt64Type}
    2 : <CFString 0x8f55ac [0x3c7b1f8]>{contents = "body"} = <CFBasicHash 0x8287e130 [0x3c7b1f8]>{type = immutable dict, count = 1,
entries =>
    2 : <CFString 0x8287e750 [0x3c7b1f8]>{contents = "error"} = <CFBasicHash 0x8287cc10 [0x3c7b1f8]>{type = immutable dict, count = 4,
entries =>
    0 : <CFString 0x8282aae0 [0x3c7b1f8]>{contents = "type"} = <CFString 0x8287a510 [0x3c7b1f8]>{contents = "OAuthException"}
    1 : <CFString 0x8287def0 [0x3c7b1f8]>{contents = "code"} = <CFNumber 0x7a906b70 [0x3c7b1f8]>{value = +1, type = kCFNumberSInt32Type}
    3 : <CFString 0x8287fdd0 [0x3c7b1f8]>{contents = "fbtrace_id"} = <CFString 0x8287f970 [0x3c7b1f8]>{contents = "C0APfOSCSX9"}
    5 : <CFString 0x8287db10 [0x3c7b1f8]>{contents = "message"} = <CFString 0x8287ba00 [0x3c7b1f8]>{contents = "An unknown error has occurred."}
}

}

}
, NSLocalizedRecoveryOptions=(
    OK
), NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again.}}

怎么了?

刚用管理员账号试了一下,非测试用户,也不行。

【问题讨论】:

    标签: ios facebook facebook-opengraph facebook-share


    【解决方案1】:

    我通过在 Facebook 应用程序设置中启用“publish_actions”并在“位置”中指向正确的 Facebook 页面 ID 解决了此类问题。

    您可以在此处查看位置 ID - https://findmyfbid.com/

    【讨论】:

    • 当您可以描述通过 API 执行此操作的方式时,为什么要链接到第三方站点?我对 API 不是特别熟悉,但 this 似乎是一个很好的方法,可以在没有阴暗的第三个站点的情况下做到这一点。
    【解决方案2】:

    原来它必须是"og:type": "testapp:location" 而不是"og:type": "location"...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多