环顾四周,特别是关注Pinterest API文档,我认为我已经正确设置了所有内容,但在尝试登录时仍然得到error NSError: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: unauthorized (401)"
。授予SDK文档在Objective-C中,但我认为我的Swift转换看起来像好?我能想到的唯一事情就是他们必须在他们的最后批准APP ID?Pinterest需要在OAuth工作之前授权App ID吗?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
PDKClient.configureSharedInstanceWithAppId("XXX")
return true
}
func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool {
let pdkClient: PDKClient = PDKClient.sharedInstance()
return pdkClient.handleCallbackURL(url)
}
PDKClient.sharedInstance().getAuthenticatedUserPinsWithFields(Set(["id", "image", "note"]), success:
{ (pdk :PDKResponseObject!) -> Void in
print("success /(pdk)")
}) { (err :NSError!) -> Void in
print("error NSError: \(err)")
}
<key>LSApplicationQueriesSchemes</key>
<array>
<string>pinterestsdk.v1</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>pinit</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
您是否必须等到该应用获得批准?我得到这个错误(401),但该应用程序仍在开发 – TomSawyer
不,该应用程序不需要批准您的电话工作......我猜你的错误是(1)与应用程序传输安全性有关,请参阅我上面的代码或(2)您的API调用写入不正确。 – GarySabo
我做所有它需要的东西,但仍然得到这个错误。 Pinterest上的应用程序在1周后仍未获得批准,因此我取消将Pinterest按钮插入到我的应用程序中。用户可以使用分享表。愚蠢的pinterest – TomSawyer