Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Search APIs & Universal Links

2.804 Aufrufe

Veröffentlicht am

@cm_ios9

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

Search APIs & Universal Links

  1. 1. Search APIs & Universal Links Mercari Inc. @kitasuke
  2. 2. About me
  3. 3. Mercari
  4. 4. My works → Cardio -Simple HealthKit wrapper for workout app in watchOS 2- → PagingMenuController -Paging view controller with customizable menu- → GoogleMaterialIconFont -Google Material Design Icons for Swift and ObjC-
  5. 5. My future talks → Introducing new features for watchOS 2 @MOSA software meeting
  6. 6. Search API
  7. 7. Completely New Search Experience
  8. 8. App results appear in Spotlight and Safari even app not installed
  9. 9. Rich contents with powerful action
  10. 10. Universal and Seamless experience
  11. 11. How it works
  12. 12. Index contents via Search APIs
  13. 13. What to index?
  14. 14. Index Architecture
  15. 15. On-Device index
  16. 16. Apple's cloud index
  17. 17. Let's see in-depth features!
  18. 18. 3 Search APIs
  19. 19. NSUserActivity
  20. 20. App Search → Activities can be designated as searchable → Add indexable metadata → Results in Spotlight and Safari → Revisit activity on Search selection
  21. 21. Enable Capabilities var eligibleForHandoff: Bool var eligibleForSearch: Bool var eligibleForPublicIndexing: Bool
  22. 22. Provide Attributes and Keywords var title: String? var keywords: Set<String> var contentAttributeSet: CSSearchableItemAttributeSet? var expirationDate: NSDate
  23. 23. Restoring on the Web var webpageURL: NSURL?
  24. 24. Create Activity var activity: NSUserActivity = NSUserActivity(activityType: "com.example") activity.title = "Baked Potato Chips" activity.userInfo = ["id": "http://www.example.com/recipe/111"] activity.eligibleForSearch = true activity.eligibleForPublicIndexing = true activity.becomeCurrent()
  25. 25. Continue Activity func application(UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: [AnyObject]? -> Void) -> Bool { if userActivity.activityType == "com.example" { // Restore state for userActivity and userInfo } return true }
  26. 26. Public Indexing → Activities can be designated as public → Multiple users engage with device results → Popular public results available to other users → Results in Search and Safari (if URL included)
  27. 27. Public vs Private → Designated "public" if searchable activity fields are solely public → Provisions to prevent user-specific activities from being indexed
  28. 28. Additional Benefits
  29. 29. Handoff
  30. 30. Siri suggestions
  31. 31. CoreSpotlight
  32. 32. CoreSpotlight → For any app content → Methods to add, update and delete items → Used by Messages, Mail, Calendar and Notes
  33. 33. Create item // Create attributeSet and populate with metadata let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeImage as String) attributeSet.title = "Haleakala Sunrise" attributeSet.contentDescription = "May 12, 2015 Maui, Hawaii" // Create item with unique identifier, domainIdentifier used to group items let item = CSSearchableItem(UniqueIdentifier: "1", domainIdentifier: "album-1", attributeSet: attributeSet)
  34. 34. Index item // Index item CSSearchableIndex.defaultSearchableIndex().indexSearchableItems([item]) { error in if error != nil { print("Item indexed!") } }
  35. 35. Restore // Application delegate called when CoreSpotlight result is tapped func application(UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: [AnyObject]? -> Void) -> Bool { if userActivity.activityType == CSSearchableItemActionType { let uniqueIdentifier = userActivity.userInfo? [CSSearchableItemActivityIdentifier] as? String // Use 'uniqueIdentifier' } return true }
  36. 36. Update // Same method as adding item to index func indexSearchableItems(items: [CSSearchableItem], completionHandler: ((NSError?) -> Void)?)
  37. 37. Delete // Identifiers func deleteSearchableItemsWithIdentifiers(identifiers: [String], completionHandler: ((NSError?) -> Void)?) identifiers = ["1", "4", "5"]
  38. 38. Delete // DomainIdentifier func deleteSearchableItemsWithDomainIdentifiers(DomainIdentifiers: [String], completionHandler: ((NSError?) -> Void)?) domainIdentifiers = ["domain-2"]
  39. 39. Delete // All func deleteAllSearchableItemsWithCompletionHandler(completionHandler: ((NSError?) -> Void)?)
  40. 40. Web Markup
  41. 41. Indexing Web Content → The content driving your app may live on the web, not locally inside the app → Deep linked pages from your app's website are indexed for app search
  42. 42. Applebot finds deep links from the web
  43. 43. Enabling app search 1. Allow Apple to discover and index your app's website 2. Ensure your app's website contains markup for mobile deep links 3. Enable deep link handling for your app 4. Add markup for structured data (optional, but highly recommended)
  44. 44. Smart App Banners if app is not installed, Safari prompts the user <meta name="myApp" content="app-id=123, app-argument=https://example.com/about affiliate-date=optionalAffiliateData"> app-argument is passed to application(_:openURL:sourceApplication:annotation:), and is also used to index your app
  45. 45. Deep Linking → Universal link https://developer.apple.com/videos/wwdc/2014/? include=101#101 → Custom URL scheme apple://wwdc/2014/?include=101#101
  46. 46. Universal links advantages → Unique → Secure → Flexible → Work seamlessly across app and website
  47. 47. Support Universal Link in your server → Create your apple-app-site-association file → Generate an SSL certification → Sign your file → Upload to your server
  48. 48. Support Universal Link in your app func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]!) -> Void) -> Bool var webpageURL: NSURL? var activityType: String let NSUserActivityTypeBrowsingWeb: String class NSURLComponents: NSObject
  49. 49. Configure your associated domains
  50. 50. Other deep link schemes Twitter Cards <meta name="twitter:app:name:iphone" content="myAppName"> <meta name="twitter:app:id:iphone" content="myAppID"> <meta name="twitter:app:url:iphone" content="myURL"> Facebook's App Links <meta name="al:ios:app_name" content="myAppName"> <meta name="al:ios:app_store_id" content="myAppID"> <meta name="al:ios:url" content="myURL">
  51. 51. Support deep linking func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { // In this example, the URL is http://example.com/profile/?123 guard let component = NSURLComponents(URL: url, resolvingAgainstBaseURL: true), let path = component.path, let query = component.query else { return false } if path == "/profile" { // Pass the profile ID from the URL, to the view controller return profileViewController.loadProfile(query) } return false }
  52. 52. Rich Results → Go beyond just a title and description → Results can contain images, structured data, and even actions → Rich results are more engaging to users and can improve your ranking
  53. 53. Other deep link schemes Open Graph <meta property="og:image" content="http://example.com/hello.jpg"> <meta property="og:audio" content="http://example.com/music.m4a"> <meta property="og:video" content="http://example.com/cats.mp4"> schema.org JSON-LD <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "AggregateRating", "ratingValue": "4", "reviewCount": "250" } </script>
  54. 54. Supported schemas → AggregateRating → Offers → PriceRange → InteractionCount → Organization → Recipe
  55. 55. App Search API Validation Tool Test your webpage for iOS 9 Search APIs. Enter a URL and Applebot will crawl your webpage and show how you can optimize for best results. https://search.developer.apple.com/appsearch- validation-tool/
  56. 56. Improve Ranking
  57. 57. Relevance
  58. 58. Linking 3 APIs
  59. 59. Linking 2 APIs
  60. 60. Relevance score
  61. 61. User Experience
  62. 62. Descriptive Results
  63. 63. Richer results have better satisfaction and engagement → Thumbnail, well-structured description, ratings, and actions → Relevant and applealing image → Key information user is looking for
  64. 64. Keywords associate your result with queries → Typical items should have 3 to 5 keywords → Category keywords, e.g., "ticket" or "recipe" → Synonyms or abbreviations for item subject
  65. 65. UI Behavior on App Launch
  66. 66. Speed Time from tapping a search result to the content in your app is measured and used in ranking.
  67. 67. Data protection Pay attention to the appropriate data protection level for your user's content.
  68. 68. Common FAQs
  69. 69. Not showing in the search results → Try using different keywords → In the case of Web Markup, results will only show up after the page has been crawled by Applebot, and once a certain level of relevance has been attained
  70. 70. Supported devices? App Search is available with iOS9, However, the search functionality of NSUserActivity and CoreSpotlight are not supported on the iPhone 4s, iPad 2, iPad (3rd generation), iPad mini, and iPod touch (5th generation).
  71. 71. Available on OS X? CoreSpotlight and the search functionality of NSUserActivity are not supported. However, web search results may be shown.
  72. 72. References Introducing Search APIs Seamless Linking to Your App iOS Search API Best Practices and FAQs

×