Xcode 14.3版本运行项目报错

1、Xcode升级到14后,编译报错:

Signing for "xxx" requires a development team. select a development team in the signing & capabilities editor

该错误为Pod库中包含Test的Target,需要设置Team ID

解决方案①:针对报错的库,手动选择签名的 Team


解决方案②:在Podfile 中添加一下代码,dev_team的值为开发者账号的 Team ID,

post_install do |installer|

  dev_team = “xxxxxxxxxxx"

     project = installer.aggregate_targets[0].user_project

     project.targets.each do |target|

         target.build_configurations.each do |config|

             if dev_team.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?

                 dev_team = config.build_settings['DEVELOPMENT_TEAM']

             end

         end

end

2、

拨错信息 ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a

clang: error: linker command failed with exit code 1 (use -v to see invocation)


从报错信息看,都是在链接库的时候因为找不到静态库(libarclite_iphonesimulator.a/libarclite_iphoneos.a)而报错。利用访达的前往文件夹功能快速来到报错信息中的目录,发现连arc目录都不存在,更不用说静态库文件。

现在可以确定的是Xcode 14.2版本肯定是正常的,那会不会是14.3版本移除了整个arc目录?找到一台还没升级到Xcode 14.3版本的电脑,在同样的路径下,果然存在arc目录,

因为系统已经内置有ARC相关的库,所以没必要再额外链接,至少Xcode 14支持的最低部署目标iOS 11及以上版本的系统肯定是没问题的。如果应用部署目标不低于iOS 11还出现问题,那么应该是第三方库的部署目标有问题。

现在Xcode 14.3移除arc目录的原因已经很清楚,是因为支持的最低部署版本的系统都已经内置了ARC相关的库。如果应用最低部署目标版本本身不低于iOS 11,解决这个问题很简单,只需要将第三方库部署目标的iOS版本设置成和应用最低部署目标的iOS版本一致。

解决方案①: arc文件下载的链接: https://pan.baidu.com/s/1MI6Mr-gqOO6Yg_P9B5jpPg 密码: 6ows

把arc的文件复制到指定目录路径:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib

解决方案②:设置第三方库最低可运行的系统版本,在Podfile 中添加一下代码,并执行pod install 命令

post_install do |installer|

  installer.pods_project.targets.each do |target|

    target.build_configurations.each do |config|

      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ‘11.0'

    end

  end

end

3、

报错信息PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-0CE87C2C48C36989195F6D5E.sh (in target 'Runner' from project 'Runner')

    cd /Users/shelly/Desktop/JA/qns_partner/ios

    /bin/sh -c /Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-0CE87C2C48C36989195F6D5E.sh

mkdir -p /Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks

Symlinked...

rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AliyunOSSiOS.framework" "/Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks"

building file list ... rsync: link_stat "/Users/shelly/Desktop/JA/qns_partner/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AliyunOSSiOS.framework" failed: No such file or directory (2)

done

sent 29 bytes  received 20 bytes  98.00 bytes/sec

total size is 0  speedup is 0.00

rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]

Command PhaseScriptExecution failed with a nonzero exit code


解决方案①:手动修改,修改 /Pods/Target Support Files/Pods-{product名称}/Pods-{product名称}-frameworks.sh,搜索source="$(readlink "${source}")”  并改为     source="$(readlink -f "${source}”)"

解决方案②:在Podfile中添加一下代码,并执行pod install 命令

post_install do |installer|

  installer.pods_project.targets.each do |target|

    shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"

    if File::exists?(shell_script_path)

      shell_script_input_lines = File.readlines(shell_script_path)

      shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }

      File.open(shell_script_path, 'w') do |f|

        shell_script_output_lines.each do |line|

          f.write line

        end

      end

    end

  end

end

针对Xcode 升级中的问题可以在Podfile中添加一下代码统一处理,dev_team 修改成自己的TeamID ,并执行pod install 命令,

post_install do |installer|

  dev_team = “xxxxxx"

     project = installer.aggregate_targets[0].user_project

     project.targets.each do |target|

         target.build_configurations.each do |config|

             if dev_team.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?

                 dev_team = config.build_settings['DEVELOPMENT_TEAM']

             end

         end

  installer.pods_project.targets.each do |target|

    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"

        target.build_configurations.each do |config|

            config.build_settings['DEVELOPMENT_TEAM'] = dev_team

        end

      end

    shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"

       if File::exists?(shell_script_path)

         shell_script_input_lines = File.readlines(shell_script_path)

         shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }

         File.open(shell_script_path, 'w') do |f|

           shell_script_output_lines.each do |line|

             f.write line

           end

         end

       end

    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|

      config.build_settings['ENABLE_BITCODE'] = 'NO'

      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'

      end

    end

  end

end

TeamID 的获取方法

TeamID的获取网站https://developer.apple.com/account

下图中红色框出来的区域为TeamID


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,242评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,769评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,484评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,133评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,007评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,080评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,496评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,190评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,464评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,549评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,330评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,205评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,567评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,889评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,160评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,475评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,650评论 2 335

推荐阅读更多精彩内容