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"
According to Nikkei Chinese website, on February ...
The launch of a product must inevitably go throug...
Almost all operational work is carried out around...
"Bringing goods" has become a topic tha...
The birth of iPhone in 2017 ushered in a new roun...
: : : : : : : : : : : : : : : How is the salary o...
When watching war movies, you must have heard the...
Having a growing pool of active users is the ulti...
Charlie's "Screenwriter Incubation Camp&...
Copywriting is not about creating words and sente...
A while ago, a resignation letter was very popula...
On March 30 this year, the world-renowned scienti...
Some time ago, a netizen @Michelangelo posted a m...
A bird's eye view of science Quanzhou Associa...
In the era of live streaming e-commerce, people a...