文件上传 - IOS 七牛7.0 上传文件报错400,不知如何解决
迷茫
迷茫 2017-04-18 09:44:37
0
2
538
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}>

不知道哪里出错了

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

Antworte allen(2)
黄舟

我者遇到这问题,你解决了吗?怎么弄的

PHPzhong

是路径问题,按提示,把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

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage