如图安卓端已成功上传,并开辟空间华南,token是从后台获取的就是传不上去求高手指引
// 华南
QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
builder.zone = [QNZone zone2];
QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];
// params:nil
// checkCrc:NO
// cancellationSignal:nil];
// NSString * token = @"从服务端SDK获取";
// NSString * key = @"指定七牛服务上的文件名,或nil";
// NSString * filePath = @"要上传的文件路径";
UIImage *image = [UIImage imageNamed:@"tab@3x"];
NSData *data = UIImagePNGRepresentation(image);
[upManager putData:data key:nil token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
if(info.ok)
{
NSLog(@"请求成功");
}
else{
NSLog(@"失败");
//如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
}
NSLog(@"info ===== %@", info);
NSLog(@"resp ===== %@", resp);
}
option:nil];
}];
以下为7牛返回内容(错误)
info ===== <QNResponseInfo= id: 557CF907-3307-447C-BB48-BDF7E349BBEE, ver: 7.1.5, status: 400, requestId: CAwAAG5kKu5c1aYU, CAwAAG5kKu5c1aYU, xlog: body:9;UP:9/400;UP:9/400, xvia: (null), host: upload.qiniu.com ip: 183.131.7.18 duration: 0.051881 s time: 1488111322 error: Error Domain=qiniu.com Code=400 "(null)" UserInfo={error=incorrect region, please use up-z2.qiniu.com}>