大佬教程收集整理的这篇文章主要介绍了使用NSUserActivity和CoreSpotlight但仍将iOS8设置为部署目标,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我假设我只需要进行iOS版本号检查或使用respondsToSELEctor:.
它是否正确?
您甚至可以保护代码,以便在有充分理由的情况下在Xcode 6下进行编译.
// Ensure it only compiles with the Base SDK of iOS 9 or later #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 // Make sure the class is available and the device supports CoreSpotlight if ([CSSearchableIndex class] && [CSSearchableIndex isIndexingAvailable]) { dispatch_async(_someBGQueue,^{ NSString *somename = @"Some Name"; CSSearchableIndex *index = [[CSSearchableIndex alloc] initWithName:somename]; // rest of needed code to index with Core Spotlight }); } #endif
在您的app委托中:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 - (BOOL)application:(UIApplication *)application conTinueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray *restorabLeobjects))restorationHandler { if ([[userActivity activityType] isEqualToString:CSSearchableItemActionType]) { // This activity represents an item indexed using Core Spotlight,so restore the context related to the unique identifier. // The unique identifier of the Core Spotlight item is set in the activity’s userInfo for the key CSSearchableItemActivityIdentifier. NSString *uniquEIDentifier = [userActivity.userInfo objectForKey:CSSearchableItemActivityIdentifier]; if (uniquEIDentifier) { // process the identifier as needed } } return NO; } #endif
以上是大佬教程为你收集整理的使用NSUserActivity和CoreSpotlight但仍将iOS8设置为部署目标全部内容,希望文章能够帮你解决使用NSUserActivity和CoreSpotlight但仍将iOS8设置为部署目标所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。