开发者社区> 问答> 正文

ios SDK 图片上传阿里云错误


upload object failed, error: Error Domain=com.aliyun.oss.clientError Code=8 "(null)" UserInfo={ErrorMessage=Catch exception - *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]}


服务器获取的阿里云信息如下:
put.bucketName = @ "dandan-image";
p ut. objectKey =   @"uploads/other/201706/83361497869482";

put. uplo adingFileURL = @" file:///var/mobile/Containers/Data/Application/7A0BB1B7-A716-4B5B-8E7E-207F237F415B/Documents/images/B7133842-7AD1-4D2F-9F9A-EA235E67735B.jpg "




上传代码:
OSSPutObjectRequest * put = [OSSPutObjectRequest new];
    
    // required fields
     put . bucketName = BucketName;
     put . objectKey = OssFile;
    put . uploadingFileURL = [ NSURL fileURLWithPath :SourceFile];
     NSLog ( @" uploadingFileURL : %@" , put. uploadingFileURL );

     //put. contentType = @"";
     //put. contentMd5 = @"";
     //put . contentEncoding = @"";
     //put. contentDisposition = @"";
     put. objectMeta = [ NSMutableDictionary dictionaryWithObjectsAndKeys : UpdateDate, @"Date" , nil ];
    
     OSSTask * putTask = [ client putObject :put];
    
     [putTask continueWithBlock :^ id ( OSSTask *task) {
         NSLog ( @"objectKey: %@" , put. objectKey );
         if (!task. error ) {
           NSLog ( @"upload object success!" );
            resolve(@YES);
        } else {
            NSLog(@"upload object failed, error: %@" , task.error);
            reject(@"-1", @"not respond this method", nil);
        }
        return nil;

    }];

展开
收起
阿泥楼尊者 2017-06-19 19:49:33 4949 0
2 条回答
写回答
取消 提交回答
  • object为空,本地有这个object文件吗
    2017-06-20 05:52:19
    赞同 展开评论 打赏
  • 很高兴认识大家
    Reios SDK 图片上传阿里云错误
    错误已经说明了
    NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]

    -------------------------

    Reios SDK 图片上传阿里云错误
    是不是UpdateDate为nil?
    2017-06-19 21:17:21
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
手淘iOS性能优化探索 立即下载
From Java/Android to Swift iOS 立即下载
深入剖析iOS性能优化 立即下载