开发者社区 问答 正文

ios sdk的一个报错,小白请教

用的是demo里的代码



// 异步上传
- ( void)uploadObjectAsync {
    OSSPutObjectRequest * put = [OSSPutObjectRequest new ];


    // required fields
    put. bucketName = @"gogogame-sh" ;
    put. objectKey = @"lkmtest";
     NSString * docDir = [ self getDocumentDirectory];
    put. uploadingFileURL = [ NSURL fileURLWithPath :[docDir stringByAppendingPathComponent : @"file10m" ]];
    // optional fields
    put. uploadProgress = ^( int64_t bytesSent, int64_t totalByteSent, int64_t totalBytesExpectedToSend) {
         NSLog( @"%lld, %lld, %lld", bytesSent, totalByteSent, totalBytesExpectedToSend);
    };
    put. contentType = @"";
    put. contentMd5 = @"";
    put.contentEncoding = @"" ;
    put.contentDisposition = @"" ;


     OSSTask * putTask = [ client putObject:put];


    [putTask continueWithBlock:^ id( OSSTask *task) {
         NSLog( @"objectKey: %@", put. objectKey);
         if (!task. error) {
             NSLog (@"upload object success!" );
        } else {
             NSLog (@"upload object failed, error: %@" , task. error );
        }
         return nil;
    }];
}
最后报了

2016-04-30 18:24:43.797 oss_ios_demo[2297:1907] upload object failed, error: Error Domain=com.aliyun.oss.clientError Code=8 "The operation couldn’t be completed. (com.aliyun.oss.clientError error 8.)" UserInfo=0x1453e790 {ErrorMessage=Catch exception - *** setObjectForKey: object cannot be nil (key: x-oss-security-token)}

展开
收起
gogo2016a 2016-04-30 18:37:06 10176 分享 版权
3 条回答
写回答
取消 提交回答
  • Reios sdk的一个报错,小白请教
    怎么解决的 ?我也遇到同样问题?
    2016-08-23 10:01:56
    赞同 展开评论
  • Reios sdk的一个报错,小白请教
    怎么解决的啊??我也遇到这个问题。
    2016-05-13 18:04:03
    赞同 展开评论
  • Reios sdk的一个报错,小白请教
    已解决,其实还是参数没填对
    2016-04-30 21:36:16
    赞同 展开评论