提问人:Random guy 提问时间:11/11/2023 最后编辑:Random guy 更新时间:11/13/2023 访问量:25
应用程序在后台工作时出现深度链接问题(Braze 提供程序)、React Native、iOS
Deeplink problem when application working in the background (Braze provider), React Native, iOS
问:
我从 braze 帐户发送时遇到深度链接问题。深度链接应该为我打开一些,比如说应用程序中的弹出窗口。当应用程序关闭并且我从 Braze 发送推送通知时,我将在我的 ios 移动设备上收到它,当我单击它时,它会将我重定向到载入页面(如果深度链接设置为“载入”),但是如果我的应用程序在后台运行并且我收到带有深度链接的推送通知, 当我单击该推送通知时,它只会打开应用程序,并且不会将我导航到想要的屏幕。
我有 appDelegate.mm 文件,这是在里面定义的
// Deep Linking
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
NSLog(@"Calling RCTLinkingManager with url %@", url);
return [RCTLinkingManager application:application openURL:url options:options];
}
// Universal links
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler
{
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}
在app.tsx中,我有
setupLinking = async () => {
// Listen to links opened when the app is closed
const initialLink = await Linking.getInitialURL();
if (initialLink) {
this.onURLEvent({ url: initialLink });
}
// Listen to links opened in the app or when the app is in background
Linking.addEventListener('url', this.onURLEvent);
};
onURLEvent = async (event: { url: any; }) => {
const { url } = event;
if (!url) {
return;
}
const link = getLinkFromDynamicLink(url);
const eventMethod = getMethodFromLink(link);
}
答: 暂无答案
评论