目前这是我的代码
NSFileManager *fileManager = [[NSFileManager alloc] init];
BOOL receiptExists = NO;
BOOL didLog = NO;
while (!receiptExists) {
receiptExists = [fileManager fileExistsAtPath:PATH];
if (!didLog) {
NSLog(@"[NOTICE]: Waiting for the file to appear...\n");
didLog = YES;
}
}
// rest of the code
这个while循环消耗了大量资源,我确信有更好的obj-c实现。有什么想法?