Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Search APIs in Xamarin.iOS

Feedback

In this article

This article covers using the App Search APIs provided by iOS 9 to allow users to search for information and features inside your Xamarin.iOS apps.

Search has been expanded in iOS 9 to provide great new ways to access informationand features inside a Xamarin.iOS app. Using the new App Search APIs, app contentis made searchable through Spotlight and Safari search results, Handoff and SiriReminders and Suggestions. This allows users to quickly access activities andinformation deep within your app.

Additionally, the new Search APIs make it easier to integrate search in your appwithout prior search implementation experience. Because of this, Apple claimsthat it typically takes a few hours to make an iOS 9 app's content universallysearchable using App Search.

An example of iOS 9 app content universally searchable using App Search

App Search is composed of three separate APIs:

  1. NSUserActivity - This is an extension of the Handoff API that Applereleased in iOS 8. It is used to make app interaction history searchableboth publicly and privately) by the user.

  2. Core Spotlight - Allows an app to index its content to be presented insearch results. It works like a database API where items can be added andremoved and it is the best way to index private content within an app.

  3. WebMarkup - For apps that provide access to their content via a webinterface (not only from within the app). Web content can be marked up withspecial links that will be crawled by Apple and provide deep linking to yourapp on the user's iOS 9 device.

Selecting an App Search Approach

Deciding which of these methods to implement depends on the types of interactionprovided by your app and the type of content it presents.

Use the following guidelines:

  • NSUserActivity – Use this framework to provide searchability for bothpublic and private content and also searchability of navigation points within your app.

  • Core Spotlight – Use this framework to providesearchability for private data stored on the device.

  • Web Markup – Use this framework to provide searchability for apps that presenttheir content not only from within the app, but from the app's website as well.

Each of the App Search approaches are distinct and can be used individually,however Apple designed them to work together. When using more than one approachto index a specific item, ensure that you use the sameItem ID on each approach,so that individual links work together.

Using more than one approach not only ensures that your content will be found bythe end user but also helps to improve your item's ranking from within search.

While the ranking process in mostly transparent to the developer, user interactionwith a given item weighs heavily upon this rank (for example the user taping a link).By providing rich, informative items, you can ensure that a user will be enticed tointeract with your content, thus raising its ranking.

What Content to Index

Apple provides the following suggestions as to what content and actions to providesearch indexes for in your app:

  • Any content viewed, created or curated by the user from within your app.
  • Navigation points and features within the app.
  • Things like new messages, content or other types of items displayed by your app thathave recently been downloaded to the device.

App Search Enhancements

Core Spotlight in iOS 10 provides several enhancements to App Search such as:

  • Crowdsourced Deep-Link Popularity (with differential privacy) - Provides a way to promote deep-linked app content in search results.
  • In-App Searching - Use the newCSSearchQuery class to provide in-app Spotlight search ability similar to how the Mail, Messages and Notes apps work.
  • Search Continuation - Allows a user to start a search in Spotlight or Safari, then open an app and continue that search.
  • Visualization of Validation Results - Apple'sApp Search API Validation Tool now displays a visual representation of a website's markup and deep-linking when preforming tests.
  • Message App Image Sharing - Allows popular in-app images provided for sharing in Messages (via a Message App Extension) to appear in Spotlight searches.

To find out more, please see ourApp Search Enhancements guide.

Proactive Suggestions

iOS 10 presents new ways of driving engagement to an app by allowing the system to proactively present helpful information automatically to the user at appropriate times. Just as iOS 9 provided the ability to add deep search to the app using Spotlight, Handoff and Siri Suggestions, with iOS 10 an app can expose functionality that can be presented to the user by the system from within the following locations:

  • The App Switcher
  • The Lock Screen
  • CarPlay
  • Maps
  • Siri Interactions
  • QuickType Suggestions

An app exposes this functionality to the system using a collection of technologies such asNSUserActivity, web markup, Core Spotlight, MapKit, Media Player and UIKit.

To find out more, please see ourProactive Suggestions guide.

Summary

This article has covered the new Search API features that iOS 9 provides forXamarin.iOS apps. It coveredNSUserActivity,Core SpotlightandWeb Markup methods for indexing content. It finished with a short discussionof when a given search approach should be used and what types of content should be indexed.

Related Links


  • Last updated on

In this article