8 Replies
      Latest reply on Aug 12, 2015 1:59 PM by E2D
      kristin Level 1 Level 1 (0 points)

        I'm able to add items to the CSSearchableIndex on the iOS9 simulator, but on a device I see:

         

        [com.apple.corespotlight.log.index] Hit Error index items:Error Domain=CSIndexErrorDomain Code=-1003 "The operation couldn’t be completed. (CSIndexErrorDomain error -1003.)"

         

        Error code translates to enum value CSIndexErrorCodeRemoteConnectionError with the comment //There was an error trying to communicate with the remote process

         

        Anyone else seeing this issue?

        • Re: CoreSpotlight error (iOS9)
          pdm Apple Staff Apple Staff (1,770 points)

          Could you file a bug report (bugreport.apple.com, or use the "Report Bugs" link at the bottom of this page) and include the entire console output from the device you're experiencing this on?  What kind of device is this?  Please post the bug number after filing it.  Thanks!

            • Re: CoreSpotlight error (iOS9)
              aamann Level 1 Level 1 (10 points)

              I get the following on an iPad2:

               

              Jun 21 21:26:36 AAM-iPad-2 searchd(CoreSpotlight)[123] <Notice>: <CFString 0x166a7570 [0x38802f98]>{contents = "[com.apple.corespotlight.log] Indexing is not supported on this device."}
              Jun 21 21:26:36 AAM-iPad-2 bird(CoreSpotlight)[100] <Notice>: <CFString 0x176a9010 [0x38802f98]>{contents = "[com.apple.corespotlight.log.index] Hit Error fetch client state:Error Domain=CSIndexErrorDomain Code=-1003 "The operation couldn\M-b\M^@\M^Yt be completed. (CSIndexErrorDomain error -1003.)""}
              

               

              Does this mean that CoreSpotlight does not work on the iPad 2?

            • Re: CoreSpotlight error (iOS9)
              photogrammer Level 1 Level 1 (0 points)

              same issue here, works great on simulator but not on my iPad mini (first gen)

               

              Error Domain=CSIndexErrorDomain Code=-1003 "The operation couldn’t be completed. (CSIndexErrorDomain error -1003.)"


                [[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:itemArray completionHandler: ^(NSError * __nullable error) {
                NSLog(@"CSSearchableIndex: %@",error ? error.description : @"successfully added all items");
                }];
              
                • Re: CoreSpotlight error (iOS9)
                  pdm Apple Staff Apple Staff (1,770 points)

                  That is correct, CoreSpotlight is not available on iPad mini. 

                    • Re: CoreSpotlight error (iOS9)
                      photogrammer Level 1 Level 1 (0 points)

                      The API is available on iPad mini (it doesn't crash) but it shouldn't be used??

                       

                      How do I determine if I should bother pushing info to CoreSpotlight?

                       

                      Right now I simply check for OS ≥ 9 as seems to be the latest MO. (I'm from the oldschool where we used to check for the class or selector being present. :-)

                       

                      All three of the classes used when talking to CoreSpotlight... CSSearchableItemAttributeSet, CSSearchableItem, and CSSearchableIndex are returning objects and seem to be working fine, it's just that final call to submit the results that's generating an error. Should I simply ignore that error then?

                       

                      [[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:itemArray completionHandler: ^(NSError * __nullable error) {
                        NSLog(@"CSSearchableIndex: %@",error ? error.description : @"successfully added all books");
                      }];
                      
                        • Re: CoreSpotlight error (iOS9)
                          pdm Apple Staff Apple Staff (1,770 points)

                          For the moment, I would recommend leaving the code as it is and simply ignoring that error.  If you want to conditionalize your code to avoid this work on devices where it's not supported, it would be helpful to get bug reports requesting the ability to identify whether CoreSpotlight is supported on a particular device or not.

                           

                          And if you're writing Swift code, you definitely want to be using the new availability support there for conditionalizing iOS 9 or not. 

                            • Re: CoreSpotlight error (iOS9)
                              photogrammer Level 1 Level 1 (0 points)

                              The project is pure Obj-C. I have a global float representing the current iOS version that I check for >=9

                               

                              I assume this is equivalent to the Swift iOS version conditionalizing?? Here's my code...

                               

                                if( iOSVersion>=9 ) {
                                     NSMutableArray *itemArray = [NSMutableArray arrayWithCapacity:productDictionary.count];
                              
                                     ... populate itemArray with CSSearchableItem here ...
                              
                                     [[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:itemArray completionHandler: ^(NSError * __nullable error) {
                                          NSLog(@"CSSearchableIndex: %@",error ? error.description : @"successfully added all books");
                                     }];
                                }
                              
                              • Re: CoreSpotlight error (iOS9)
                                E2D Level 1 Level 1 (0 points)

                                To check if a device supports indexing, call

                                [CSSearchableIndex isIndexingAvailable]
                                

                                you can then decide if you want to perform any indexing.