我正在尝试使用示例上传照片:Tumblr 提供的 PhotoPostExample (https://github.com/tumblr/TMTumblrSDK)
我好像无法上传照片。我已经可以发布文本帖子并查看用户信息,所以我认为该应用程序已经过身份验证。我已经检查过 NS Bundle 中提到的照片是否存在,确实存在。我什至缩小了照片以使其文件大小更小,但仍然无法上传。
它显示了这个错误:
Error Domain=Request failed Code=401 "The operation couldn’t be completed. (Request failed error 401.)"
这是我使用的 Tumblr 提供的 postphoto 中的代码:
[[TMAPIClient sharedInstance] photo:@"blogname"
filePathArray:@[[[NSBundle mainBundle] pathForResource:@"blue" ofType:@"png"]]
contentTypeArray:@[@"image/png"]
fileNameArray:@[@"blue.png"]
parameters:@{@"caption" : @"Caption"}
callback:^(id response, NSError *error) {
if (error)
NSLog(@"Error posting to Tumblr %@", error);
else
NSLog(@"Posted to Tumblr");
}];
非常感谢您的帮助! - 米歇尔
最佳答案
您正在查看回调中的“error
”参数,这很好。
但是,如果您想要更多有用的细节,请解析 JSON response
,您最终可能会看到如下内容:
(NSDictionary *) $1 = 0x0715df70 {
meta = {
msg = "Not Authorized";
status = 401;
};
response = ( );
}
我怀疑您没有像您认为的那样通过身份验证。
关于ios - 无法使用 Tumblr SDK 示例发布照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21049624/