gpt4 book ai didi

ios - LISDKErrorAPIDomain错误403

转载 作者:行者123 更新时间:2023-11-28 06:13:44 24 4
gpt4 key购买 nike

我正在尝试通过我的应用程序将 url、图像和文本共享到 linkedin。但它显示错误为

The operation couldn’t be completed. (LISDKErrorAPIDomain error 403.)

我的代码是

func didLinkedinBtnPressed(cellObject: MyModel) {

let tmp = ["comment": cellObject.strSocialText!,
"content": ["title":"AppName", "description":cellObject.strSocialText!,"submitted-url":cellObject.strWebSite!,"submitted-image-url":cellObject.strImageUrl!],"visibility": ["code": "anyone"]] as [String : Any]
print("PostDtaa = \(tmp)")
let postData = try? JSONSerialization.data(withJSONObject: tmp, options: .prettyPrinted)

let url = NSString(string:"https://api.linkedin.com/v1/people/~/shares?format=json")

let permissions: [AnyObject] = [LISDK_BASIC_PROFILE_PERMISSION as AnyObject, LISDK_EMAILADDRESS_PERMISSION as AnyObject,LISDK_W_SHARE_PERMISSION as AnyObject]

LISDKSessionManager.createSession(withAuth: permissions, state: nil, showGoToAppStoreDialog: true, successBlock: { (success) -> () in
if LISDKSessionManager.hasValidSession() {

LISDKAPIHelper.sharedInstance().postRequest(url as String, body: postData, success: { (_ response) in
print(response ?? "")
self.simpleAlert(titleOfAlert: "Success", messageOfAlert: "Shared Successfully")


LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()

}, error: { (_errorRes) in
print(_errorRes?.localizedDescription ?? "No Error!!!")



LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()

})
}

}, errorBlock: { (error) -> () in
print("%s", "error called!")

LISDKAPIHelper.sharedInstance().cancelCalls()
LISDKSessionManager.clearSession()
})
}

为什么我在这里收到 403 错误?

最佳答案

我在过去试验过类似的问题,它与 w_share 权限有关

来自 linkedin doc

Required permission: w_share

Whether set as a default permission in your app settings or requested specifically via the scope argument during your authentication process, you will need to request the w_share member permission in order for your application to successfully make the API call to share content.

w_share 默认是禁用的,所以必须明确启用 enter image description here

注意: token 可以由应用程序缓存,因此为了确保使用新 token (具有更新的权限),我强烈建议您从移动设备上卸载所有内容并重新安装。

关于ios - LISDKErrorAPIDomain错误403,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45732682/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com