I have an iOS14 widget that I want to deep link to a screen in my (React-Native) app.
I've set up the deep link on the app side and I can open the desired screen from safari when testing.
example link: myapp://detail/123
AppDelegate.m is set up like so:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
if([url.scheme hasPrefix:@"myapp"]) {
return [RCTLinkingManager application:application openURL:url options:options];
}
...
}
...then I have a working receiver in the RN code that uses Linking
to process the URL. All good.
The issue is that when I trigger the link on my widget it opens the app but doesn't go via AppDelegate and so the link isn't processed.
var body: some View {
ZStack(alignment: .topLeading) {
...
}
.widgetURL(URL(string: "myapp://detail/\(myIdValue)"))
}
I've added the value myapp
to the URLScheme
value in my main app's info.plist and then the URL Types
> URL Identifier
value in my widget's info.plist.
I'm probably missing something obvious here but does anyone know where I'm going wrong?