You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter添加关联域名权限iOS端不生效及打包异常排查

Flutter iOS通用链接Testflight失效+命令行打包Pod问题解决方案

一、通用链接Testflight失效排查与修复

本地Xcode运行正常,但Testflight打开链接跳网页,核心是打包时关联域名权限未正确嵌入IPA,按以下步骤排查:

  1. 确认流水线打包命令包含entitlements参数
    检查Azure DevOps YAML中的xcodebuild命令,必须指定--entitlements指向项目中的Runner.entitlements文件,示例:

    xcodebuild archive -workspace Runner.xcworkspace -scheme Runner -archivePath build/Runner.xcarchive --entitlements Runner/Runner.entitlements
    

    同时要确保流水线使用的Provisioning Profile是已添加关联域名权限的版本,避免使用旧的无权限profile。

  2. 验证IPA中的权限配置
    下载Testflight的IPA文件,解压后打开Payload/Runner.app/embedded.mobileprovision,搜索com.apple.developer.associated-domains,确认存在你的域名配置(比如applinks:yourdomain.com)。如果没有,说明打包时未嵌入entitlements,需调整流水线命令。

  3. 重新验证apple-app-site-association文件
    访问https://你的域名/.well-known/apple-app-site-association,确保返回的JSON格式正确:

    {
      "applinks": {
        "apps": [],
        "details": [
          {
            "appID": "你的TeamID.你的BundleID",
            "paths": ["*"]
          }
        ]
      }
    }
    

    同时确保服务器返回的Content-Type为application/json,而非text/plain。苹果服务器可能缓存旧配置,可等待1-2小时后再测试。

二、命令行打包module 'share_plus' not found+Pods为空问题修复

这类问题通常是依赖缓存或Pod安装不完整导致,按以下步骤解决:

  1. 清理所有缓存文件
    在项目根目录执行:

    flutter clean
    cd ios
    pod deintegrate
    pod cache clean --all
    rm -rf Podfile.lock .symlinks
    
  2. 重新安装依赖与Pods
    回到项目根目录,依次执行:

    flutter pub get
    cd ios
    # 普通Mac
    pod install --repo-update
    # M1/M2芯片Mac需用Rosetta
    arch -x86_64 pod install --repo-update
    
  3. 调整Azure DevOps流水线步骤
    在YAML中添加依赖安装步骤,确保xcodebuild前完成依赖准备:

    - script: |
        flutter pub get
        cd ios
        pod install --repo-update
      displayName: 'Install Flutter & iOS dependencies'
    
  4. 修复GeneratedPluginRegistrant文件
    如果仍报share_plus模块未找到,手动删除ios/Runner目录下的GeneratedPluginRegistrant.h和GeneratedPluginRegistrant.m,然后执行flutter pub get,Flutter会自动重新生成正确的注册文件。

内容的提问来源于stack exchange,提问作者JennaL__

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 10:57:22