Dưới đây là một ví dụ về cách thêm nội dung ứng dụng của bạn để Spotlight thông qua tìm kiếm mới của API. Đây là có sẵn trên iOS9 sử dụng XCode 7.
CSSearchableItemAttributeSet * attributes = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeImage]; //Or whatever type
attributes.contentDescription = @"This is my content description.";
attributes.displayName = @"Display Name";
attributes.keywords = @["Stuff","Widget"];
attributes.subject = @"Subject";
attributes.title = @"Title";
CSSearchableItem *item = [[CSSearchableItem alloc] initWithUniqueIdentifier:someUniqueId domainIdentifier:@"SomeGroupName" attributeSet:attributes];
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:@[item] completionHandler:nil];
Khi người sử dụng chọn các mục trong ánh đèn sân khấu, các phương pháp sau đây:
-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler
trong appdelegate của bạn sẽ được gọi. Kiểm tra từ điển userInfo trong đối tượng userActivity và gửi người dùng đến màn hình thích hợp.
Tôi đoán bạn nghe sai, tôi không thể tìm thấy một điều duy nhất trong tài liệu về hội nhập với ánh đèn sân khấu trên iOS. – rckoenes
http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/SpotlightCoreData/SpotlightCoreData.pdf – utahwithak
@openfrog, tôi chưa thấy nó được thực hiện trong iphone và ipad nhưng nó có thể được thực hiện với mac, đây là liên kết đến mã mẫu spotlighter cho mac nếu có thể giúp. https://developer.apple.com/library/mac/#samplecode/Spotlighter/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008818 –