Rumah  >  Artikel  >  pembangunan bahagian belakang  >  iOS 七牛图片上传,错误响应怎么解决?

iOS 七牛图片上传,错误响应怎么解决?

不言
不言asal
2018-05-18 14:33:341628semak imbas


七牛上传图片进度一直到0.95报错报错信息:

<QNResponseInfo= id: 045DDA6D-EF09-40B2-99D5-DCAA62330C3C, ver: 7.1.0, status: 400, requestId: NwkAAE39Vn76IH8U, NwkAAE39Vn76IH8U, xlog: body:3;UP:3/400;UP:28/400, xvia: 1.1 fwt16:2 (Cdn Cache Server V2.0), host: upload.qiniu.com ip: 60.10.3.48 duration: 8.792564 s time: 1476935464 error: Error Domain=qiniu.com Code=400 "(null)" UserInfo={error=incorrect zone, please use up-z1.qiniu.com}>
QNresp========(null)

代码:

-(void)requestQNWithdata:(NSData *)data{
    
    AFManagerHelp *manager = [[AFManagerHelp alloc]init];
    
    [manager POST:uploadNOToken Splice:nil parameters:nil success:^(id responseObject) {
        
        NSString *upToken = [responseObject objectForKey:@"uptoken"];
        NSLog(@"token::===== %@",upToken);
        [self uploadPictureToQiNiu:data withToken:upToken];
        
    } failure:^(NSError *error) {
        NSLog(@"QNerror==%@",error.userInfo);
    }];
}


//上传七牛
-(void)uploadPictureToQiNiu:(NSData *)data withToken:(NSString *)token{
    
    QNUploadManager *upManager = [[QNUploadManager alloc]init];

    QNUploadOption * uploadOption= [[QNUploadOption alloc] initWithMime:nil progressHandler:^(NSString *key, float percent) {
        
        NSLog(@"QNpercent == %.2f",percent);
        
    } params:nil checkCrc:NO cancellationSignal:nil];

    
    [upManager putData:data key:nil token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
        
        NSLog(@"QNinfo ===== %@\nQNresp========%@",info,resp);
        
    } option:uploadOption];
}

说我方法写错还是token问题?

回复内容:

七牛上传图片进度一直到0.95报错报错信息:

<QNResponseInfo= id: 045DDA6D-EF09-40B2-99D5-DCAA62330C3C, ver: 7.1.0, status: 400, requestId: NwkAAE39Vn76IH8U, NwkAAE39Vn76IH8U, xlog: body:3;UP:3/400;UP:28/400, xvia: 1.1 fwt16:2 (Cdn Cache Server V2.0), host: upload.qiniu.com ip: 60.10.3.48 duration: 8.792564 s time: 1476935464 error: Error Domain=qiniu.com Code=400 "(null)" UserInfo={error=incorrect zone, please use up-z1.qiniu.com}>
QNresp========(null)

代码:

-(void)requestQNWithdata:(NSData *)data{
    
    AFManagerHelp *manager = [[AFManagerHelp alloc]init];
    
    [manager POST:uploadNOToken Splice:nil parameters:nil success:^(id responseObject) {
        
        NSString *upToken = [responseObject objectForKey:@"uptoken"];
        NSLog(@"token::===== %@",upToken);
        [self uploadPictureToQiNiu:data withToken:upToken];
        
    } failure:^(NSError *error) {
        NSLog(@"QNerror==%@",error.userInfo);
    }];
}


//上传七牛
-(void)uploadPictureToQiNiu:(NSData *)data withToken:(NSString *)token{
    
    QNUploadManager *upManager = [[QNUploadManager alloc]init];

    QNUploadOption * uploadOption= [[QNUploadOption alloc] initWithMime:nil progressHandler:^(NSString *key, float percent) {
        
        NSLog(@"QNpercent == %.2f",percent);
        
    } params:nil checkCrc:NO cancellationSignal:nil];

    
    [upManager putData:data key:nil token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
        
        NSLog(@"QNinfo ===== %@\nQNresp========%@",info,resp);
        
    } option:uploadOption];
}

说我方法写错还是token问题?

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn