我有以下代码:
- (void)readSettingsFiles
{
NSOperationQueue *operationQueue = [[[NSOperationQueue alloc] init] autorelease];
[operationQueue setName:@"File Parsing Queue"];
if (urlForV1SettingsFile) {
[operationQueue addOperationWithBlock:^{
SettingsReader *settingsReader = [[[SettingsReader alloc] initWithURL:urlForV1SettingsFile] autorelease];
NSArray *settings = [settingsReader settings];
[settingsToSave addObjectsFromArray:settings];
}];
}
if (urlForV2SettingsFile) {
[operationQueue addOperationWithBlock:^{
SettingsReader *settingsReader = [[[SettingsReader alloc] initWithURL:urlForV2SettingsFile] autorelease];
NSArray *settings = [settingsReader settings];
[settingsToSave addObjectsFromArray:settings];
}];
}
while ([operationQueue operationCount] > 0) {
sleep(1);
}
}
SettingsReader
是一个处理读取两个不同 XML 文件的 NSXMLParser 委托。settingsToSave
是声明此方法的类的属性,类型为 NSDictionary。
我有睡眠,所以在所有文件都被解析之前,该方法不会返回。
问题是,当我退出 while 循环时,我在控制台中收到此错误:
objc[74760]: Class _NSZombie_NSCFInputStream is implemented in both ?? and ??. One of the two will be used. Which one is undefined.
以前从未见过,谷歌也没有。有什么帮助吗?