QNUploadOption * option = [[QNUploadOption alloc] initWithMime:@"image/png" progressHandler:nil params:nil checkCrc:NO cancellationSignal:nil];
QNUploadManager * uploadManager = [[QNUploadManager alloc] init];
NSString * documentDIR = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
[uploadManager putFile:[documentDIR stringByAppendingPathComponent: photoModel.filePath] key:response.body[@"key"] token:response.body[@"uptoken"] complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
NSLog(@"upload info : %@", info);
NSLog(@"upload resp : %@", resp);
} option:option];
我生成拍照文件的就是PNG图片,经由服务器获取token后,拿着去上传。【之前我也有尝试过option传nil,但也是不行】
返回值每次都是:
Printing description of info:
<QNResponseInfo= id: CA426F62-51EB-4724-BF1A-56FC8628108D, ver: 7.0.19, status: 400, requestId: sgYAAA-RI4ZvQXcU, sgYAAA-RI4ZvQXcU, xlog: UP:3/400;UP:18/400, xvia: 1.1 tietong99:2 (Cdn Cache Server V2.0), host: upload.qiniu.com ip: 222.42.4.112 duration: 0.165821 s time: 1474719350 error: Error Domain=qiniu.com Code=400 "(null)" UserInfo={error=incorrect zone, please use up-z1.qiniu.com}>
不知道哪里出错了
我者遇到這問題,你解決了嗎?怎麼弄的
是路徑問題,按提示,把qiniu.com,換成up-z1.qiniu.com就妥了
兩個方法
1.你在專案裡搜尋qiniu.com,會發現有兩個方法,一個zone0,一個zone1,把裡面的qiniu.com,改成up-z1.qiniu.com
2.或者,你進QNConfiguration.m,QNConfigurationBuilder類別的init的方法裡,有句_zone = [QNZone zone0];,你把這裡改嘍,改成up-z1.qiniu.com的那個zone就行了
恩恩,就醬
ps:個人建議用方法2