CoreSpotlight is available on iOS 9 onwards.
Although your device may be on iOS 9.x, it may still not work if it is an older version of the device.
From Apple docs.
Although app search is available for iOS 9 users, NSUserActivity and Core Spotlight search features are not supported on iPhone 4, iPad 2, iPad (3rd generation), iPad mini, and iPod touch (5th generation).
So, if you test on any of the above devices or simulators, you will get CSIndexErrorDomain error -1005.
From Corespotlight API documentation
CSIndexErrorCodeIndexingUnsupported = -1005, // Indexing is not supported on this device
source share