我写了一个用Applinking华为生成链接的方法
fun generateLink(text: String, promo: String): Single<String> = Single.create { emitter ->
AppLinking.newBuilder()
.setUriPrefix(Const.Deeplink.BASE_URL_APPLINKING)
.setDeepLink(Uri.parse(Const.Deeplink.BASE_WEB + addParams(mapOf(Const.Deeplink.PARAM_PROMOCODE to promo))))
.setAndroidLinkInfo(AppLinking.AndroidLinkInfo.newBuilder()
.setAndroidDeepLink(AGS + Const.Deeplink.PACKAGE_NAME_ANDROID)
.build()
)
.setIOSLinkInfo(AppLinking.IOSLinkInfo.newBuilder()
.setIOSDeepLink(AGS + Const.Deeplink.PACKAGE_NAME_IOS)
.setBundleId(Const.Deeplink.PACKAGE_NAME_IOS)
.build()
)
.buildShortAppLinking(ShortAppLinking.LENGTH.SHORT)
.addOnSuccessListener { link ->
Timber.e("${link.testUrl}")
text.plus("\n").plus(link.shortUrl?.toString()).also {
emitter.onSuccess(it)
Timber.e(it)
}
}.addOnFailureListener {
var dr = Const.Deeplink.PACKAGE_NAME_ANDROID
var df = Uri.parse(Const.Deeplink.BASE_WEB + addParams(mapOf(Const.Deeplink.PARAM_PROMOCODE to promo)))
emitter.onError(it)
}
}但是有一个错误
com.huawei.agconnect.applinking.AppLinkingException: code: 204865654 message: [AppGalleryConnectLinkManageService]the ios bundleId does not have permission有没有人见过这个?PACKAGE_NAME_IOS是有效的com.65gb.xxxxx.xxxxx
下班后

发布于 2021-05-19 09:11:28
更新
您需要将AppLinking iOS SDK集成到bundleID为com.65gb.xxxx.xxxx的iOS工程中,然后使用handleAppLinking接口接收并获取配置好的iOSDeepLink。
有关如何在iOS中接收AppLinking的详细信息,请参阅document。

确保您的iOS应用程序的包ID与使用setBundleId()方法传递的参数相同。您可以在AppGallery连接中查看套餐ID。
应用链接用于项目下的所有应用。在AppGallery连接中,您只能在包名在同一项目中的应用之间实现重定向。
https://stackoverflow.com/questions/67591381
复制相似问题