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)

相关推荐
小鹿软件办公5 小时前
苹果因通信问题撤回面向旧款 iPhone 和 iPad 的系统更新
ios·iphone
Thomas_YXQ15 小时前
Unity3D在ios平台下内存的优化详解
开发语言·macos·ios·性能优化·cocoa
zhyongrui1 天前
SwiftUI 光晕动画性能优化:消除托盘缩放卡顿的实战方案
ios·性能优化·swiftui
TheNextByte11 天前
如何通过 6 种方式删除 iPhone/iPad 上的文件
ios·iphone·ipad
WeiAreYoung1 天前
uni-app Xcode制作iOS谷歌广告Google Mobile Ads SDK插件
ios·uni-app
2501_916008891 天前
iOS 开发助手工具,设备信息查看、运行日志、文件管理等方面
android·ios·小程序·https·uni-app·iphone·webview
编程之路从0到11 天前
React Native新架构之iOS端初始化源码分析
react native·ios·源码剖析·新架构·初始化流程
2501_915921431 天前
在没有源码的前提下,怎么对 Swift 做混淆,IPA 混淆
android·开发语言·ios·小程序·uni-app·iphone·swift
00后程序员张2 天前
对比 Ipa Guard 与 Swift Shield 在 iOS 应用安全处理中的使用差异
android·开发语言·ios·小程序·uni-app·iphone·swift
00后程序员张2 天前
在 iOS 设备上同时监控 CPU、GPU 与内存的方法
android·ios·小程序·https·uni-app·iphone·webview