[TIMOB-19640] iOS9 Spotlight Search isSupported function doesn't work on pre-iOS9 devices
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2015-10-01T18:10:34.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.1.0 |
Components | iOS |
Labels | ios9, spotlight |
Reporter | Cameron |
Assignee | Angel Petkov |
Created | 2015-09-22T22:06:24.000+0000 |
Updated | 2015-10-14T16:41:15.000+0000 |
Description
Im using .isSupported() to check if my iOS8.3 device should create indexs for Spotlight search. However, the isSupported call throws an error
Code to test with (modified version from the Spotlight search sample app):
// Create an instance of the index
var searchableIndex = Ti.App.iOS.createSearchableIndex();
// Check if Spotlight is supported (since iOS 9)
if (searchableIndex.isSupported()) {
alert('You have iOS9 Spotlight Search');
}
Error I am given when used on the actual device:
"undefined is not an object (evaluating 't.isSupported')"
Hello Im sorry your having issued with the platform , however unless you have both Xcode 7 and an iOS 9 device the searchableIndex will never get created. As previous iOS don't support the function, also is not part of the compile library for Xcode version prior to 7. The best approach to this problem would be to check the iOS version before initializing the variable .
Angel, Thats fine, I am manually checking the iOS version now, but what is the purpose of .isSupported() then ?
The searchableIndex.isSupported() method just checks if your currently on Xcode 7, if you are it returns a message saying your device is supported.However unless you are on IOS 9 the object will never actually be created. I hope that helps.