判断文件是否存在
OSS iOS SDK 提供了方便的同步接口以检测 Bucket 中是否存在指定的文件。
以下代码用于判断指定文件是否存在:
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 {
NSLog(@"Error!");
}
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
评论