aliyun对象存储oss iOS上传文件,
阿里云的oss对象存储官方demo
put.uploadingFileURL = [NSURL fileURLWithPath:@"<filePath>"];
// put.uploadingData = <NSData *>; // 直接上传NSData。
这里需要一个文件path,直接写文件名是不行的 。
报错upload object failed, error: Error Domain=NSCocoaErrorDomain Code=260 "The file “123456.png” couldn’t be opened because there is no such file.
正确写法应该是:
NSString * filePath = [[NSBundle mainBundle] pathForResource:@"123456" ofType:@"png"];
put.uploadingFileURL = [NSURL fileURLWithPath:filePath];
然后就成功了!!!