首頁 > 後端開發 > php教程 > iOS 七牛圖片上傳,錯誤回應怎麼解決?

iOS 七牛圖片上傳,錯誤回應怎麼解決?

不言
發布: 2023-03-01 08:56:01
原創
1647 人瀏覽過


七牛上傳圖片進度一直到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問題?

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板