HBuilder IOS 打包异常:com.apple.developer.associated-domains权利 ,解决!

报错信息

Appid: __UNI__64DFE1E
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild archive -sdk iphoneos14.1 -project [PackagePath]/HBuilder.xcodeproj -archivePath [PackagePath]/XArchive/HBuilder.xcarchive -scheme HBuilder CONFIGURATION=Release

User defaults from command line:
IDEArchivePathOverride = [PackagePath]/XArchive/HBuilder.xcarchive

Build settings from command line:
CONFIGURATION = Release
SDKROOT = iphoneos14.1

note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: Provisioning profile \"huozhu\" doesn't support the Associated Domains capability. (in target 'HBuilder' from project 'HBuilder')
error: Provisioning profile \"huozhu\" doesn't include the com.apple.developer.associated-domains entitlement. (in target 'HBuilder' from project 'HBuilder')
** ARCHIVE FAILED **

Error code = 0
Error message:
opendir([PackagePath]/XArchive/exportArchive): failed to open dir: No such file or directory

报错原因

  • Universal Link是苹果在WWDC 2015上提出的iOS 9的新特性之一。此特性类似于深层链接,并能够方便地通过打开一个Https链接来直接启动您的客户端应用(手机有安装App)。对比起以往所使用的URL Sheme, 这种新特性在实现web-app的无缝链接时能够提供极佳的用户体验。
  • 使用前请阅读 苹果官方文档
  • 使用通用链接(Universal Link)必须要有域名,下的配置中将要用到
一 开启Associated Domains服务

在这里插入图片描述

  • 开启Associated Domains服务后需要重新生成profile文件,提交云端打包时使用
二 配置Associated Domains(域名)

在这里插入图片描述
在这里插入图片描述

  • 使用HBuilderX云端打包时在manifest.json中配置域名
  • 在"plus" -> “distribute” -> “apple” -> “capabilities” -> “entitlements"节点(uni-app项目在"app-plus” -> “distribute” -> “ios” -> “capabilities” -> “entitlements”)下添加"com.apple.developer.associated-domains"字段,字段值为字符串数组,每个字符串为要关联的域名
"capabilities": {  
        "entitlements": {  
            "com.apple.developer.associated-domains": [  
                "applinks:demo.dcloud.net.cn"  
            ]  
        }  
    }
  • 其中demo.dcloud.net.cn是应用通用链接的域名(这里不要包含path),请修改为自己应用要使用的域名

  • 视图设置
    在这里插入图片描述

  • 保存后提交云端打包生效。

  • HBuilderX中自带的默认真机运行基座HBuilderX注册的通用链接为:https://demo.dcloud.net.cn/ulink/

三 服务器配置apple-app-site-association文件
  • 需要在上面域名对应的服务器上放apple-app-site-association文件。
    apple-app-site-association文件配置如下:
{  
    "applinks": {  
        "apps": [],  
        "details": [  
            {  
                "appID": "G56NU654TV.io.dcloud.HBuilder",  
                "paths": [ "/ulink/*"]  
            }  
        ]  
    }  
}
  • apps
    必须对应一个空的数组
  • appID
    由前缀和ID两部分组成,可以登录苹果开发者网站,在“Certificates, Identifiers & Profiles”页面选择“Identifiers”中选择对应的App ID查看
  • paths
    对应域名中的path,用于过滤可以跳转到App的链接,支持通配符*,?以及NOT进行匹配,匹配的优先级是从左至右依次降低
  • 注意:不要直接拷贝使用上面的示例,必须根据自己应用的配置修改
  • 把配置好的apple-app-site-association文件上传到你自己的服务器,确保通过https://demo.dcloud.net.cn/.well-known/apple-app-site-association可访问。
  • 其中demo.dcloud.net.cn为上面配置的域名
  • 应用安装后会通过访问上面的url向系统注册应用的通用链接。

参考文章出处:https://ask.dcloud.net.cn/article/36393

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值