【发布时间】:2011-12-22 11:55:23
【问题描述】:
目前这里是我的代码
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 实现。有什么想法吗?
【问题讨论】:
标签: objective-c filesystems while-loop nsfilemanager