The OSS SDK for iOS provides a convenient synchronous API to check whether the specified object exists in a bucket.


The following code provides an example on how to determine whether an object exists:

NSError * error = nil;
BOOL isExist = [client doesObjectExistInBucket:TEST_BUCKET withObjectKey:@"file1m" withError:&error];
if (!error) {
    if(isExist) {
        NSLog(@"File exists.");
    } else {
        NSLog(@"File not exists.");
} else {