[TIMOB-23528] iOS10: Support new CoreSpotlight APIs
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-07-12T22:14:04.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 5.5.0 |
| Components | iOS |
| Labels | ios10 |
| Reporter | Hans Knöchel |
| Assignee | Hans Knöchel |
| Created | 2016-06-14T23:59:59.000+0000 |
| Updated | 2016-09-13T10:44:44.000+0000 |
Description
iOS 10 offers new API's for the
CoreSpotlight framework. In detail, these are new attributes for the CSSearchableItemAttributeSet as well as the CSSearchQuery to query an attribute set by it's attribute name. An API should be proposed here first.
First PR to support the new API's in
CSSearchableItemAttributeSet: https://github.com/appcelerator/titanium_mobile/pull/8070 We should clone this ticket for supporting theCSSearchQuery. *Demo*:var win = Ti.UI.createWindow({ backgroundColor : "#fff" }); var btn = Ti.UI.createButton({ title : "Add searchable index" }); btn.addEventListener("click", function() { addToSearchableIndex(); }); win.add(btn); var nav = Ti.UI.iOS.createNavigationWindow({window: win}); nav.open(); function addToSearchableIndex() { var itemAttr = Ti.App.iOS.createSearchableItemAttributeSet({ itemContentType: Ti.App.iOS.UTTYPE_AUDIO, title: 'Who rocks iOS 10?', // iOS 10 only fullyFormattedAddress: "1732 N 1st St, San Jose, CA 95112", postalCode: "95112", thoroughfare: "N 1st St", subThoroughfare: "1732", keywords: ['appcelerator', 'titanium_mobile', 'ios10', 'corespotlight'] }); var item = Ti.App.iOS.createSearchableItem({ identifier: 'core-spotlight', domainIdentifier: 'ios10', attributeSet: itemAttr }); var indexer = Ti.App.iOS.createSearchableIndex(); indexer.addToDefaultSearchableIndex([item], function(e) { if (e.success) { alert('Press the home button and now search for your keywords'); } else { alert('Error: ' + JSON.stringify(e.error)); } }); }PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8221
Verified implemented, using: MacOS 10.12 (16A239m) Ti SDK 5.5.0.v20160825003900 Appc NPM 4.2.7 Appc CLI 5.5.0-5 Alloy 1.9.1 Xcode 8.0 (8S201h) Able to create searchableItems and search for them outside of the app, without error. Tested using the provided code, code from the SearchableItemAttributeSet documentation, as well as self made tests that create, configure, and search for the searchable items.
[~hansknoechel], created TIMOB-23828 to track
CSSearchQueryimplementationnote -- should be uniqueIndentifier or you get errors