reactnativecn/react-native-qq

请问如何判断是否安装安卓QQ,现在是调用API就直接崩溃

Opened this issue · 2 comments

请问如何判断是否安装安卓QQ,现在是调用API就直接崩溃,就算加了try catch也不行,直接崩溃

解决了,修改源码,增加方法
export function isQQInstalledAction() {
return QQAPI.isQQInstalled().then((res)=>{
() => waitForResponse("QQAuthorizeResponse")
})
}
然后在js里使用
QQAPI.isQQInstalledAction().then((res)=>{
QQAPI.shareToQQ(qqshareInfo).then((res)=>{
// console.log('--shareToQQ--res:',res)
}).catch((err)=>{
// console.log('--shareToQQ--err:',err)
})
}).catch((err)=>{
Alert.alert(
'提示',
'您还没有安装QQ客户端,请安装QQ后再试'
)
})

QQAPI.isQQInstalled()
.then(install=>{
console.log('安装QQ'+install)
})
.catch(unInstall=>{
console.log('没有安装QQ'+unInstall)
})