Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23528] iOS10: Support new CoreSpotlight APIs

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-07-12T22:14:04.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.5.0
ComponentsiOS
Labelsios10
ReporterHans Knöchel
AssigneeHans Knöchel
Created2016-06-14T23:59:59.000+0000
Updated2016-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.

Comments

  1. Hans Knöchel 2016-06-16

    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 the CSSearchQuery. *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));
               }
           });
       }
       
  2. Hans Knöchel 2016-08-14

    PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8221
  3. Eric Wieber 2016-08-25

    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.
  4. Eric Wieber 2016-08-25

    [~hansknoechel], created TIMOB-23828 to track CSSearchQuery implementation
  5. Jason Kneen 2016-09-13

    note -- should be uniqueIndentifier or you get errors

JSON Source