Pinterest IOS SDK getBoardPins 响应代码=-1011“请求失败:错误请求 (400)”
Posted
技术标签:
【中文标题】Pinterest IOS SDK getBoardPins 响应代码=-1011“请求失败:错误请求 (400)”【英文标题】:Pinterest IOS SDK getBoardPins response Code=-1011 "Request failed: bad request (400)" 【发布时间】:2016-01-06 03:45:02 【问题描述】:我收到一个错误的请求返回
PDKClient.sharedInstance().getBoardPins(boardID, fields: ["image", "description"], withSuccess: (responseObject :PDKResponseObject!) -> Void in
print(responseObject.pins().first!.descriptionText)
) (err :NSError!) -> Void in
print("error NSError: \(err)")
从以下位置传递 boardID:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
if let dvc = segue.destinationViewController as? PinCollectionViewController
dvc.boardID = selectedBoard.identifier
我不知道为什么?我知道我的板 ID 是正确的,并尝试对其进行硬编码。我已经通过了身份验证...
来自 SDK:
/**
* Get a list of pins for the given board. The response can be used to get
* the bext page of pins.
*
* @param boardId ID of the board
* @param fields The pin fields that will be returned by the api
* @param successBlock Called when the API call succeeds
* @param failureBlock Called when the API call fails
*/
- (void)getBoardPins:(NSString *)boardId
fields:(NSSet *)fields
withSuccess:(PDKClientSuccess)successBlock
andFailure:(PDKClientFailure)failureBlock;
【问题讨论】:
【参考方案1】:我将字段更改为:
PDKClient.sharedInstance().getBoardPins(boardID, fields: ["id", "image", "note"], withSuccess: (responseObject :PDKResponseObject!) -> Void in
print(responseObject.pins().first!.descriptionText)
) (err :NSError!) -> Void in
print("error NSError: \(err)")
并且能够成功收到响应
【讨论】:
以上是关于Pinterest IOS SDK getBoardPins 响应代码=-1011“请求失败:错误请求 (400)”的主要内容,如果未能解决你的问题,请参考以下文章
无法为类似 Pinterest 的 iOS 应用加载 [UIButton] 数组的所有项目
我们如何将 Pinterest 的 iOS 应用大小减少 30% 以上
如何使用带有 Pinterest.sharextension 的 UIActivityViewController 设置 Pinterest sourceURL 和描述