Tumblr:头像请求不返回URL

时间:2013-03-14 15:20:51

标签: ios tumblr mknetworkkit

我使用MKNetwork Kit

MKNetworkOperation *op = [[MKNetworkOperation alloc] initWithURLString:@"http://api.tumblr.com/v2/blog/my_blog.tumblr.com/avatar/512"
                                                                        params:nil
                                                                    httpMethod:@"GET"];

        [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
            UIImage *img = [completedOperation responseImage];
            DLog(@"%f x %f", img.size.height, img.size.width); //512 x 512
            NSFileManager *fileManager = [NSFileManager defaultManager];
            NSData *myImageData = UIImagePNGRepresentation(img);
        [fileManager createFileAtPath:@"/Users/Mac/Desktop/myimage.png" contents:img attributes:nil];
        } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
            DLog(@"error: %@",error);
        }];

   [self enqueueOperation:op];

和!哦!美妙的Tumblr!我的桌面上有一个图像。

如何使用字段avatar_url阻止此行为并更改对json的响应?

UPD:

试试这个:

curl http://api.tumblr.com/v2/blog/my_blog.tumblr.com/avatar/512

它会返回

{"meta":{"status":301,"msg":"Found"},"response":{"avatar_url":"good_link_here"}}

UPD 2:

Good answer
我必须停止重定向。

0 个答案:

没有答案