【发布时间】:2018-09-14 15:34:21
【问题描述】:
单击从 Branch.io 生成的深层链接时,我无法让 Branch.subscribe 触发。深层链接会打开应用程序 (my-app),这很好,但任何具有相同架构 (my-app) 的链接都会这样做。所以我无法确认 Expo 的 Branch 是否真的在 Android 上运行。
我尝试了一些变化。从 Expo 的例子开始:
componentDidMount() {
logger('COMPONENT MOUNTED') // runs
DangerZone.Branch.subscribe((bundle) => {
logger('PLS WORK') // doesn't run
});
}
}
分公司的例子:
_unsubscribeFromBranch = null
componentDidMount() {
logger('COMPONENT MOUNTED') // runs
_unsubscribeFromBranch = DangerZone.Branch.subscribe(({error, params}) => {
logger('PLS WORK') // doesn't run
})
}
componentWillUnmount() {
if (_unsubscribeFromBranch) {
_unsubscribeFromBranch()
_unsubscribeFromBranch = null
}
}
subscribe() 调用中的记录器永远不会触发。应用在深度链接 url 上打开,componentDidMount() 运行,但 subscribe 对链接没有反应。
我正在使用 Expo 的 Branch 实现(Expo v25,react-native-branch 2.0.0-beta.3)。如果可能的话,我想避免脱离世博会。
从 ADB 记录的其他错误:
04-04 11:41:42.319 30352 30352 E i : java.lang.ClassNotFoundException: abi25_0_0.host.exp.exponent.modules.api.branch.RNBranchModule
04-04 11:41:42.319 30352 30352 E i : Runtime exception in RNObject when calling method initSession: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.reflect.Method[] java.lang.Class.getMethods()' on a null object reference
【问题讨论】:
标签: react-native expo branch.io