23 Replies
      Latest reply on Oct 4, 2015 8:49 AM by umut
      vmnKCatigbe Level 1 Level 1 (0 points)

        I'm attempting to implement the latest search APIs in our app.

         

        From following the code samples, I've done most of the implementation.  Is there a way to verify the result, either on the simulator or on device?

         

        I don't see any sample projects other than the sample code on the site and in the presentation - so I'm not sure if I'm missing anything in the implementation.

        • Re: Verifying Search APIs are working?
          bbousquet Level 2 Level 2 (60 points)

          The simulator does not support the new search features (just like it doesn't support Handoff). That's what I was told by at the WWDC 15 labs.

           

          They also seemed to overlook the need for search item localization when putting the feature together.

          • Re: Verifying Search APIs are working?
            pdm Apple Staff Apple Staff (1,770 points)

            For things like the NSUserActivity and CoreSpotlight APIs you should be able to add that code, run it on a device, then go into Search on your device and search for things like the keywords, description, or content you've added to the local device index.  If something isn't showing up when you'd expect it to please file a bug report, preferably with a small sample project illustrating the issue. 

              • Re: Verifying Search APIs are working?
                vmnKCatigbe Level 1 Level 1 (0 points)

                Cool, seeing the results now, just not getting any thumbnail images  in my results.  I'm using CSSearchableItemAttributeSet and setting the thumbnail data, but only seeing the app icon. Any ideas?

                  • Re: Verifying Search APIs are working?
                    pdm Apple Staff Apple Staff (1,770 points)

                    As mentioned in the iOS 9 Release Notes, thumbnails and descriptions aren't showing up correctly in seed 1. 

                    • Re: Verifying Search APIs are working?
                      wukii Level 1 Level 1 (0 points)

                      I user NSUserActivity added to search index, but I can not search the conent?

                      I create a NSUserActivity, set eligibleForSearch YES, and called [activity becomeCurrent].

                      but I can not search the content of activity. How did you see the results?

                        • Re: Verifying Search APIs are working?
                          pdm Apple Staff Apple Staff (1,770 points)

                          One thing that has bitten a few people (myself included) is that the activity must not be deallocated.  If your code is only working with NSUserActivities (i.e. not using CoreSpotlight in addition) then make sure your activities aren't being deallocated immediately.  In my case, I had code that was allocating the NSUA, setting some properties on it, calling becomeCurrent, but then the object would go out of scope and deallocated. If you're doing this, try tossing the activity into a strong property to see if you can then see the results when you search. 

                           

                          If you're unable to get it to work, please file a bug report and attach your project so we can take a look (and post your bug number here). 

                    • Re: Verifying Search APIs are working?
                      umut Level 1 Level 1 (0 points)

                      I have added NSUseractivity. But I don't have Hand off feature on my app. It seems without Hand off Apple doesn't accept apps. Anyone has an idea?