iphone iCloud app crashes when compiling on iOS 4

前端 未结 3 1650
梦毁少年i
梦毁少年i 2021-01-27 05:05

I\'d like to use an iCloud, but when I compile the app on iOS 4.3 Simulator it crashes.

dyld: Symbol not found: _OBJC_CLASS_$_NSMetadataQuery

What should I do to

3条回答
  •  误落风尘
    2021-01-27 05:52

    my sulotion is:

    Where have NSMetadataQuery change to id: ex

    normal : - (void)loadData:(NSMetadataQuery *)query; change to: - (void)loadData:(id)query;

    normal: @property (retain, nonatomic) NSMetadataQuery *query; change to: @property (retain, nonatomic) id query;

    and check iCloud available:

    if ([[NSFileManager defaultManager] respondsToSelector:@selector(URLForUbiquityContainerIdentifier:)]) {
            NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
            if (ubiq) {
                // Code for access iCloud here
            }
        }
    

    When use NSMetadataQuery:

    id _query = [[NSClassFromString(@"NSMetadataQuery") alloc] init];
    // Some code here
    [_query startQuery];
    

    Have fun (^_^)

提交回复
热议问题