[Solved] Upload object failed, error: error domain = nscocoaerrordomain code = 260 “aliyun object stores OSS IOS upload files

Aliyun object stores OSS and IOS uploaded files,

Alibaba cloud OSS object store official demo


put.uploadingFileURL = [NSURL fileURLWithPath:@"<filePath>"];
// put.uploadingData = <NSData *>; // Upload NSData

You need a file path here. You can’t write the file name directly.

Upload object failed, error: error domain = nscocoaerrordomain code = 260 “the file” 123456.PNG “couldn’t be opened because there is no such file

The correct wording should be:

    NSString * filePath = [[NSBundle mainBundle] pathForResource:@"123456" ofType:@"png"];
    put.uploadingFileURL = [NSURL fileURLWithPath:filePath];

Then it succeeded!!!

Read More: