Example: App contains messages. User searches spotlight with string from message. Spotlight finds that app.
I have heard that spotlight can search app contents. But how to feed it to Spotlight on iOS?
Download and install Spotlight Cloud Mobile Click to download for your iPhone and iPad App or Android App.
Spotlight Search on your Apple® iPad® is used to search for contacts, email, messages, calendars, etc. Swipe down from the middle of the Home Screen. If unavailable, from a Home screen, swipe to the right to access Spotlight Search.
Spotlight can help you quickly find apps, documents, emails, and other items on your Mac. With Siri Suggestions, you can also get news, sports scores, weather conditions, stock prices, and more. Spotlight can even perform calculations and conversions for you.
According to the Core Data Spotlight Integration Programming Guide, the functionality you want is not available for iOS, only for Mac OS X.
This is now possible from iOS9 onwards.
Apple has released a CoreSpotlight SDK (WWDC2015) where, you can integrate your app to the spotlight of iOS and can do a content search.
There are other possible avenues to actually integrate different user activities to your app and can also search for things even when your app is not installed on the device.
If your app is an app that handles pdf for instance, if user searches for a pdf on his device, you app can come up in the spotlight preferences as an app he can use to read the pdf, even when your app is not installed on the user's device.
Considering your example, now its possible that if you search for a message string in spotlight, spotlight can open up your app and you can make the user actually navigate to find the exact message inside your app as well.
Adding link below : You can find details for implementation.
https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-SW3
-Tejas
Here is an example of adding your app content to Spotlight via the new Search API's. This is available on iOS9 using 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];
When the user selects the item in spotlight, the following method:
-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler
in your AppDelegate will be called. Check the userInfo dictionary in the userActivity object and send the user to the appropriate screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With