代码之家  ›  专栏  ›  技术社区  ›  Amal T S

LISDKErrorAPIDomain错误403

  •  1
  • Amal T S  · 技术社区  · 7 年前

    我的代码是

    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错误?

    1 回复  |  直到 7 年前
        1
  •  1
  •   cristallo    7 年前

    我在过去试验过一个类似的问题,它与w_共享权限有关

    linkedin doc

    特别是通过身份验证期间的scope参数 过程中,您需要在中请求w_共享成员权限 命令应用程序成功调用API以共享

    默认情况下,w\U共享已禁用,因此必须显式启用 enter image description here