{"_id":"561c6195ad272c0d00a892dd","category":{"_id":"589b8e1fdbb7cd190026732c","project":"55e67aaa9cc7c62b00c4a1ea","__v":0,"version":"55e67aab9cc7c62b00c4a1ed","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-02-08T21:31:11.878Z","from_sync":false,"order":6,"slug":"advanced-techniques","title":"Advanced Techniques"},"user":"55d29988486de50d00327118","version":{"_id":"55e67aab9cc7c62b00c4a1ed","project":"55e67aaa9cc7c62b00c4a1ea","__v":10,"createdAt":"2015-09-02T04:27:23.612Z","releaseDate":"2015-09-02T04:27:23.612Z","categories":["55e67aac9cc7c62b00c4a1ee","55e67b5556007d23005fee7d","55e67b5dde6fef23009480ca","55e680efde6fef23009480db","55e6829485a9741900314e99","561c61b4ad272c0d00a892df","586c014c0abf1d0f000d04d4","58991d2ad207df0f0002186b","589b8e1fdbb7cd190026732c","58b8ca5e3265d70f001788d4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"project":"55e67aaa9cc7c62b00c4a1ea","__v":3,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-13T01:42:45.492Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"## Supporting Notifications\nBy default, all notifications from your iOS device will appear on your watch. This means there is **nothing for developers to do in order to \"support\" Apple Watch**. \n\n## Customizing The Notification Interface\nThere are two types of customizations possible when it comes to notifications; custom and dynamic. To start, click your project and go to File > New > Target and select Apple watch. Be sure to tick \"Include Notification Scene\". Alternatively, you can add one to your existing watch app's storyboard by dragging in a `NotificationController` object, creating files and linking them up in the identity inspector.  \n\n### Static Custom Notification Interfaces\n\nThis is the most basic type of customization you can do for your alert. For this, you can include static items such as text or images. This will mean that *every* alert you receive, this content will show. Content can be added directly in Interface Builder. This can be useful if you want to include some help text or branding in your alert. However, a dynamic interface will harness the true power of Apple Watch. \n\n\n### Dynamic Custom Notification Interfaces\n\nIn this type of interface, you can have the same text and image outlets as before, but now they can be populated via the content of a push payload from APNS. You can send content for extra text fields and images for display. You have the option to create actions (just like those from [interactive notifications in iOS 8](https://developer.apple.com/videos/wwdc/2014/#713)) also. \n\nTo push custom APNS payloads in Carnival push notifications, simply use the existing [Key-Value Payloads](doc:key-value-payloads) feature. \n\n## Deep Linking from Apple Watch to iOS\n\nTo create a deep link such as a button that says \"Read Message\" from the alert, which takes the user to their Carnival Message Stream, you need to combine two technologies; [Interactive Notifications](https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html#//apple_ref/doc/uid/TP40014969-CH18-SW5) and [Handoff](https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html#//apple_ref/doc/uid/TP40014338-CH3-SW1). \n\n> __Note:__ Both of these technologies are iOS 8+ only. \n\n### Overriding Push Notification Registration\n\nCarnival automatically registers for its own push notifications. To disable this, simply alter your `startEngine` method to use the `[Carnival startEngine:appKey registerForPushNotifications:NO]` call instead. \n\nFrom here, you can register your own push notification settings. Settings include alert types (sounds, banners, alerts) as well as a category. With Interactive Notifications, you can declare a category of Notification types when registering for Notifications that include a \"Read Message\" action. An example is [here](https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html#//apple_ref/doc/uid/TP40014969-CH18-SW5).\n\n### Using Handoff\nInside `- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler` you then create a handoff action to interact with the WatchKit app's host app. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[self updateUserActivity::::at:::\\\"com.myapp.ExampleApp.openstream\\\" userInfo:nil webpageURL:nil];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nIn your AppDelegate, implement `continueUserActivity`. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {\\n\\t\\tif ([userActity.activityType isEqualToString:@\\\"com.myapp.ExampleApp.openstream]) {\\n\\t\\t\\t//Handle opening the stream, or any deep links you wish to open.\\n\\t\\t}\\n\\t}\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\nApple Watch promises some exciting engagement opportunities for your users – be sure to follow the [Human Interface Guidelines](https://developer.apple.com/watch/human-interface-guidelines/) for Apple Watch to ensure a smooth and captivating experience.","excerpt":"Supporting Apple Watch","slug":"apple-watch","type":"basic","title":"Apple Watch"}

Apple Watch

Supporting Apple Watch

## Supporting Notifications By default, all notifications from your iOS device will appear on your watch. This means there is **nothing for developers to do in order to "support" Apple Watch**. ## Customizing The Notification Interface There are two types of customizations possible when it comes to notifications; custom and dynamic. To start, click your project and go to File > New > Target and select Apple watch. Be sure to tick "Include Notification Scene". Alternatively, you can add one to your existing watch app's storyboard by dragging in a `NotificationController` object, creating files and linking them up in the identity inspector. ### Static Custom Notification Interfaces This is the most basic type of customization you can do for your alert. For this, you can include static items such as text or images. This will mean that *every* alert you receive, this content will show. Content can be added directly in Interface Builder. This can be useful if you want to include some help text or branding in your alert. However, a dynamic interface will harness the true power of Apple Watch. ### Dynamic Custom Notification Interfaces In this type of interface, you can have the same text and image outlets as before, but now they can be populated via the content of a push payload from APNS. You can send content for extra text fields and images for display. You have the option to create actions (just like those from [interactive notifications in iOS 8](https://developer.apple.com/videos/wwdc/2014/#713)) also. To push custom APNS payloads in Carnival push notifications, simply use the existing [Key-Value Payloads](doc:key-value-payloads) feature. ## Deep Linking from Apple Watch to iOS To create a deep link such as a button that says "Read Message" from the alert, which takes the user to their Carnival Message Stream, you need to combine two technologies; [Interactive Notifications](https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html#//apple_ref/doc/uid/TP40014969-CH18-SW5) and [Handoff](https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html#//apple_ref/doc/uid/TP40014338-CH3-SW1). > __Note:__ Both of these technologies are iOS 8+ only. ### Overriding Push Notification Registration Carnival automatically registers for its own push notifications. To disable this, simply alter your `startEngine` method to use the `[Carnival startEngine:appKey registerForPushNotifications:NO]` call instead. From here, you can register your own push notification settings. Settings include alert types (sounds, banners, alerts) as well as a category. With Interactive Notifications, you can declare a category of Notification types when registering for Notifications that include a "Read Message" action. An example is [here](https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html#//apple_ref/doc/uid/TP40014969-CH18-SW5). ### Using Handoff Inside `- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler` you then create a handoff action to interact with the WatchKit app's host app. [block:code] { "codes": [ { "code": "[self updateUserActivity:@\"com.myapp.ExampleApp.openstream\" userInfo:nil webpageURL:nil];", "language": "objectivec" } ] } [/block] In your AppDelegate, implement `continueUserActivity`. [block:code] { "codes": [ { "code": "- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {\n\t\tif ([userActity.activityType isEqualToString:@\"com.myapp.ExampleApp.openstream]) {\n\t\t\t//Handle opening the stream, or any deep links you wish to open.\n\t\t}\n\t}", "language": "objectivec" } ] } [/block] Apple Watch promises some exciting engagement opportunities for your users – be sure to follow the [Human Interface Guidelines](https://developer.apple.com/watch/human-interface-guidelines/) for Apple Watch to ensure a smooth and captivating experience.