Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios NSMetadataQuery在未首先调用stopQuery的情况下被解除分配?_Ios_Objective C_Macos - Fatal编程技术网

Ios NSMetadataQuery在未首先调用stopQuery的情况下被解除分配?

Ios NSMetadataQuery在未首先调用stopQuery的情况下被解除分配?,ios,objective-c,macos,Ios,Objective C,Macos,我在运行应用程序时打印此日志消息时遇到问题 <NSMetadataQuery: 0x6000000f1200> is being deallocated without first calling -stopQuery. To avoid race conditions, you should first invoke -stopQuery on the run loop on which -startQuery was called 对于Dealoc [self.query d

我在运行应用程序时打印此日志消息时遇到问题

<NSMetadataQuery: 0x6000000f1200> is being deallocated without first calling -stopQuery. To avoid race conditions, you should first invoke -stopQuery on the run loop on which -startQuery was called
对于Dealoc

 [self.query disableUpdates];
  [self.query stopQuery];
我可能遗漏了什么有人帮我弄清楚

非常感谢您的帮助

self.query = [[MetadataQuery alloc] init];
        self.query.sortDescriptors = @[[[NSSortDescriptor alloc] initWithKey:(id)kMDItemFSName ascending:YES]];
        self.query.predicate = SearchPredicateForType(type);
        self.query.delegate = self;
        self.query.searchScopes = @[_searchURL.absoluteString];
        self.query.notificationBatchingInterval = 10.0;

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(metadataQueryDidFinishGathering_Notification:) name:NSMetadataQueryDidFinishGatheringNotification object:self.query];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(metadataQueryDidUpdate_Notification:) name:NSMetadataQueryDidUpdateNotification object:self.query];
 [self.query disableUpdates];
  [self.query stopQuery];
 (void)metadataQueryDidFinishGathering_Notification:(NSNotification *)note {
    NSLog(@"type %@", @(_type));

    NSMetadataQuery *q = note.object;
    if(![q.searchScopes containsObject:_searchURL.absoluteString]) {
        NSLog(@"MISMATCH %@ %@", q.searchScopes, _searchURL);
//        return;
    }

    [q disableUpdates];
    [q stopQuery];

    [self getTotalSizeOfQuery];
}