iOS Universal Links配置

场景和配置:

app:两个app分别AppA和AppB,

域名dyhy-web.yndysc.com

配置文件目录: https://dyhy-web.yndysc.com/.well-known/apple-app-site-association

objectivec 复制代码
{
  "applinks": {
    "details": [
      {
    
        "appIDs": ["TeamID.BundleID.AppA"],//开发者账号中查看TeamID
        "components": [
          { "/": "/app/shipper/*" } //AppA的匹配路径
        ]
      },
      {
        "appIDs": ["TeamID.BundleID.AppB"],
        "components": [
          { "/": "/app/carrier/*" } //AppB的匹配路径
        ]
      }
    ]
  }
}

该json文件命名为apple-app-site-association,放在域名跟路径的.well-known下面

xcode配置

Xcode 工程 → 选择 Target → Signing & Capabilities

点击 "+" → 添加 Associated Domains 能力

在 Domains 中添加:applinks:dyhy-web.yndysc.com

这里要注意,两个app下的配置都是一样的applinks:dyhy-web.yndysc.com,

目的请看下面的解析流程

注意:

上面说的是用户手动点击链接比如https://dyhy-web.yndysc.com/app/shipper/123,当配置微信支付等其他流程的话需要在配置的时候把https://dyhy-web.yndysc.com/app/shipper/123传递给微信,然后微信支付完成后可以通过这个链接返回到app

比如:

objectivec 复制代码
    [WXApi registerApp:@"wxb2ff695b7cbd647f" universalLink:@"https://dyhy-web.yndysc.com/app/shipper"];

解析流程:

1. 用户点击链接: https://dyhy-web.yndysc.com/app/shipper/123

2. iOS 提取域名: dyhy-web.yndysc.com

3. 查找安装了哪些 App 关联了这个域名

→ 发现 AppA 和 AppB 都关联了 dyhy-web.yndysc.com

4. 从 Apple CDN 获取 AAS 文件

5. 根据 AAS 文件中的路径规则决定:

  • /app/shipper/* → 应该由 AppA 处理
  • /app/carrier/* → 应该由 AppB 处理

6. 打开相应的 App(AppA)

相关推荐
Anhty14 小时前
2026 实测 4 款 AI 变声器|QQ 聊天伪装声线,告别僵硬假声
人工智能·功能测试·ios·智能手机·安卓
唔6615 小时前
flutter web iOS 在浏览器加载中文慢的问题
前端·flutter·ios
ZacJi1 天前
我为 DeepSeek Harness 写了一个 dsh-apple-mode 插件
ios·deepseek·vibecoding
2501_915921431 天前
抓包鹰 Traceeagle 解除证书绑定,SSL Pinning 解除
网络·网络协议·网络安全·ios·adb·https·ssl
人月神话Lee2 天前
我做了个不要账号、不要定位权限的旅行 App,聊聊那些「不做」的决定
ios·ai编程·产品
2501_916007472 天前
Bundle ID 注册与管理 App ID 创建指南 命名规则 权限开关与删除注意事项
android·ios·小程序·https·uni-app·iphone·webview
2501_915909063 天前
iOS 证书创建与管理 类型限制 p12 密码与云备份实操
android·ios·小程序·https·uni-app·iphone·webview
00后程序员张3 天前
有没有更轻量的 iOS 开发环境?快蝎kxapp轻量化路径与构成
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
ii_best3 天前
iOS 投屏ios群控鹰眼中控系统安装指南|电脑端 + TestFlight + 开发者模式实操
ios·自动化·按键精灵