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 make it working on iOS 3, 4, and 5?
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 make it working on iOS 3, 4, and 5?
These API has been launched with the ios5 so you cann't run it on the simulator 4 or below but for posting you can set the minimum deployment target of ios family it should support .
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 (^_^)
The usual way would be to compile it with iOS 5 SDK and setting the deployment target to the oldest iOS Version you'd like it to work with. It's up to you though to check at runtime on which classes and methods are available to the current system. A user on iOS 4 for example will not be able to use functions that only ship with iOS 5.
To check the availability of classes do:
if ( NSClassFromString(@"NSMetadataQuery") != nil ) {
//do stuff with NSMetadataQuery here
}
To check the availability of methods do:
if ( [myObject respondsToSelector:@selector(doSomething)] ) {
//call doSomething on myObject
}