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

不知道哪里出错了

迷茫
迷茫

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

reply all(2)
黄舟

I encountered this problem, have you solved it? How did you do it

PHPzhong

It’s a path problem. Follow the prompts and replace qiniu.com with up-z1.qiniu.com. Two methods

1. If you search for qiniu.com in the project, you will find that there are two methods, one is zone0 and one is zone1. Change qiniu.com inside to up-z1.qiniu.com

2. Or, if you enter QNConfiguration.m, in the init method of the QNConfigurationBuilder class, there is a sentence _zone = [QNZone zone0];, you can change it here to the zone of up-z1.qiniu.com.

Yeah, just like that<( ̄︶ ̄)>

ps: Personally recommend method 2

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template