iphone iCloud app crashes when compiling on iOS 4

前端 未结 3 1624
梦毁少年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:30

    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
    }
    

提交回复
热议问题