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"
As user behavior undergoes tremendous changes in ...
“In 2019, the national population reached 1.4 bil...
Online shopping has become a lifestyle for contem...
There is always something big happening on Friday...
In recent years, new brands in the beauty and ski...
Text | Intelligent Relative Theory Author | Chen ...
Author: Xue Qingxin, registered nutritionist Revi...
[[389869]] Many friends find that their mobile ph...
Wu Qilong and Liu Shishi officially held their we...
In the past, when people talked about the Three G...
On the evening of November 16, a heart-wrenching ...
Since its introduction, 4K has been one of the ho...
Many people write very good content on WeChat art...
If you were a drop of water Have you moistened an...