iOS9 supports indexing the content in apps to support spotlight search, which is a very innovative feature. It should be mentioned that these indexes are stored in the local device and will not be synchronized to iCloud. If you change the device, they will be gone. The effect is this: Create search-enabled content The class that supports searchable content is CSSearchableItem. The attributes that can be displayed are title, description text, and thumbnail. It is recommended to set an expiration date (expirationDate) for each item. First, create an object CSSearchableItemAttributeSet that represents a configuration display content
AttributeSet also supports phone numbers and geographic coordinates. There will be corresponding actions on the right, and there will be an arrow if it supports navigation. (Because my app does not need this function, I have not tried it myself)
Creating a CSSearchableItem uniqueIdentifier is equivalent to the id of this data. domainIdentifier indicates the related domain. Apple also provides a set of APIs to modify and delete these indexes. domainIdentifier can be used as a parameter, for example, all indexes under a domain can be deleted.
Add CSSearchableItem to the system
Tips Most apps may also need to be compatible with iOS8. Here is how to determine whether it is compatible with iOS 8 in Swift. If you want to use iOS9 API in a method, use the following to judge (Xcode7 will also remind you).
If you want to indicate that a method you wrote is only available on iOS 9, add the following keywords to the method header to indicate that it is only available on iOS 9.
I will paste my project code directly. Processing of users selecting and opening the app after searching Just add this callback in the app delegate.
The method under OC is this
This can be used to get the identifier set when creating the CSSearchableItem
Then you can use this identifier to retrieve the corresponding data and process it. Reference Links:
|
<<: Nanjing Hearthstone CEO Zhu Wei: Mobile game development can also be "unconventional"
Activities are an effective means to drive rapid ...
Copywriting is a job with a relatively low entry ...
In the setting of "Ghost in the Shell",...
I seldom mention my love life in my articles. Fir...
Weibo, WeChat, H5, offline activities ... If you a...
Introduction: There are many comments on Alfa Go,...
This article will explain what actions need to be...
appendix: If you don’t like taking showers, you m...
On September 19, tornadoes occurred in two places...
According to media reports, Ford Ranger sales rea...
When you look up at the vast universe, have you e...
At noon on September 11, China's independentl...
This article is a review of my recent practice. T...
Newcomer's debut, complete program for amateu...
In this case, an advertiser in the education and ...