![]() ![]() And that looks a little like this, no matter which platform or SDK you use. In the end, the exact API you use will depend on the platform and SDK you're using.īut- and we're very pleased to tell you about this- SwiftUI is adding support for universal links this year too. Note that when your app is configured to use UIScene, you need to implement a different delegate method than when using only UIApplication.Īnd AppKit is similar to, but distinct from, UIKit. These are the equivalent methods when using UIKit. So, to quickly summarize, these are the methods you use to handle and open universal links when using WatchKit. So when we tap the button to order, we'll see this alert, telling us to continue on the paired iPhone. However, this Apple Watch doesn't have this restaurant's app installed. It lets us select our favorite foods, then order them in each restaurant's app by invoking a universal link. Here you can see an app we've been working on that shows us the menus for all our favorite restaurants. So, rather than leave the user with no feedback, we present UI to the user on watchOS, and that looks like this. ![]() And this method does not return a value or take a completion handler. Now, Safari is not available on watchOS except in limited contexts like Mail and Messages. Just like on our other platforms, if you attempt to open a universal link in an application that's not installed, that link will fail to open. To open a URL in another application, you use WKExtension's openSystemURL method. The body of this method will be fundamentally the same as on iOS and macOS. WKExtensionDelegate's handle(_ userActivity method is responsible for handling incoming universal links. ![]() However, on watchOS, you use WatchKit instead of UIKit, so to adopt on watchOS, we'll need to make some changes here. When you want to open a universal link in another application, you use UIApplication, openURL. We've shown how to use this delegate method in previous sessions. On iOS, or when using Mac Catalyst, you implement the UIApplicationDelegate method "application: continue userActivity: restorationHandler" to handle incoming universal links. And it's important to remember that your entitlements, including the Associated Domains entitlement, are applied to your WatchKit extension, not the containing WatchKit app. The first is that, when using WatchKit, the API is different than when using UIKit or AppKit. Universal links work the same way on watchOS as they do on our other platforms, but there are some platform-specific differences we want to share with you. The first and smallest platform we're adding support for this year is watchOS. For more detail about what universal links are and how to adopt them, check out our session from WWDC19.Īfter that high-level review of universal links, let's get to the fun stuff: support for new platforms. Where you are currently using custom URL schemes, you should migrate to universal links as soon as possible.Ĭustom URL schemes are not recommended. This creates a secure two-way association between your app and your website, allowing your app to perform special tasks on behalf of your website. The entitlement mentions your Web server's domain name, and the Web server mentions your app's application identifier. You create them by adding a special entitlement, the Associated Domains entitlement, to your app and by adding a JSON file to your Web server. ![]() They allow users to open your content in your app instead of in a Web browser, allowing you to provide a richer experience. Universal links are HTTPS or HTTP URLs that represent your content both on the Web and in your app. We've talked about universal links at WWDC before, but we'd like to give you a brief refresher. Welcome to "What's New in Universal Links." My name is Christopher Linn. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |