首页 > 其他分享 >MacOS15+Xcode版本16+对ReactNative项目进行编译和上传到APPStore的踩坑记录

MacOS15+Xcode版本16+对ReactNative项目进行编译和上传到APPStore的踩坑记录

时间:2025-01-08 17:05:35浏览次数:1  
标签:do end 16 Xcode framework APPStore file path hermes

作者:Kovli

重要通知:红宝书第5版2024年12月1日出炉了,感兴趣的可以去看看,https://u.jd.com/saQw1vP

红宝书第五版中文版

红宝书第五版英文原版pdf下载(访问密码: 9696)

1、编译报错如下

项目名/ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:57:46 Called object type 'facebook::flipper::SocketCertificateProvider' (aka 'int') is not a function or function pointer

项目名/ios/Pods/Headers/Private/Flipper/FlipperTransportTypes.h:24:14 No template named 'function' in namespace 'std'

项目名/ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:158:18 Called object type 'facebook::flipper::SocketEventHandler' (aka 'int') is not a function or function pointer
解决方案如下:

把下面的代码复制一下

post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'Flipper'
        file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
        system("chmod +w " + file_path)
        contents = File.read(file_path)
        unless contents.include?('#include <functional>')
          File.open(file_path, 'w') do |file|
            file.puts('#include <functional>')
            file.puts(contents)
          end
        end
      end
    end
  end

放到post_install do |installer|下面
例如原podfile里有如下代码

post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # Add these lines for Xcode 14 builds
    installer.generated_projects.each do |project|
      project.targets.each do |target|
          target.build_configurations.each do |config|
              config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
          end
      end
    end
    # End of added lines
  end

复制后代码如下

post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # Add these lines for Xcode 14 builds
    installer.generated_projects.each do |project|
      project.targets.each do |target|
          target.build_configurations.each do |config|
              config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
          end
      end
    end
    installer.pods_project.targets.each do |target|
      if target.name == 'Flipper'
        file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
        system("chmod +w " + file_path)
        contents = File.read(file_path)
        unless contents.include?('#include <functional>')
          File.open(file_path, 'w') do |file|
            file.puts('#include <functional>')
            file.puts(contents)
          end
        end
      end
    end
    # End of added lines
  end

即可编译成功

2 上传APPStore时报错如下

Asset validation failed
Invalid Executable. The executable '项目名.app/Frameworks/hermes.framework/hermes' contains bitcode. (ID: 
解决方案如下:

复制以下代码

bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
   def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
     framework_path = File.join(Dir.pwd, framework_relative_path)
     command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
     puts "Stripping bitcode: #{command}"
     system(command)
   end

   framework_paths = [
     "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"
   ]

   framework_paths.each do |framework_relative_path|
     strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
   end

到podfile文件的post_install do |installer|下面
例如原代码如下:

post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # Add these lines for Xcode 14 builds
    installer.generated_projects.each do |project|
      project.targets.each do |target|
          target.build_configurations.each do |config|
              config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
          end
      end
    end
    installer.pods_project.targets.each do |target|
      if target.name == 'Flipper'
        file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
        system("chmod +w " + file_path)
        contents = File.read(file_path)
        unless contents.include?('#include <functional>')
          File.open(file_path, 'w') do |file|
            file.puts('#include <functional>')
            file.puts(contents)
          end
        end
      end
    end
    # End of added lines
  end

复制后如下:

post_install do |installer|
    bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
   def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
     framework_path = File.join(Dir.pwd, framework_relative_path)
     command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
     puts "Stripping bitcode: #{command}"
     system(command)
   end

   framework_paths = [
     "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"
   ]

   framework_paths.each do |framework_relative_path|
     strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
   end
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # Add these lines for Xcode 14 builds
    installer.generated_projects.each do |project|
      project.targets.each do |target|
          target.build_configurations.each do |config|
              config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
          end
      end
    end
    installer.pods_project.targets.each do |target|
      if target.name == 'Flipper'
        file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
        system("chmod +w " + file_path)
        contents = File.read(file_path)
        unless contents.include?('#include <functional>')
          File.open(file_path, 'w') do |file|
            file.puts('#include <functional>')
            file.puts(contents)
          end
        end
      end
    end
    # End of added lines
  end

即可上传APPStore提审

Tips: 如果有如下警告:

Upload Symbols Failed
The archive did not include a dSYM for the hermes.framework with the UUIDs 

无需理会,不影响上传和提审,如果要去掉这个警告,请升级RN版本

标签:do,end,16,Xcode,framework,APPStore,file,path,hermes
From: https://www.cnblogs.com/kovli/p/18660084

相关文章

  • C51--05---LCD1602调试工具
    一、LCD1602调试工具单片机调试工具:数码管液晶屏串口数码管需要不断进行扫描,一旦扫描不及时就会不断闪烁,并且可显示的数据太过局限;串口需要使用电脑进行发送指令,不易操作与携带;所以此处使用液晶屏是比较好的选择。LCD1602作为调试工具提供类似打印函数(printf())的功能......
  • [Ynoi2016] 镜中的昆虫 题解
    [Ynoi2016]镜中的昆虫题解好题值得一做。题目大意:给一个序列,有若干个离线询问,每次可以区间推平或询问区间内的颜色个数,数据范围是\(10^5\)级别。解题思路:我们可以先考虑一个弱化版,每次是单点修改怎么做,类似于CF848C。我们考虑维护出每一个位置上一个与它相等的位置是\(p......
  • docker-compose安装mysql.211216
    0.安装docker-compose参见本站另外文章1.目录结构:按以下目录结构mkdir文件夹和相关文件**mysql目录下的data为数据目录,mysql的数据表、二进制日志文件就在这里。.env文件包含了一些变量,这些变量可以在docker-compose.yml文件中通过${variable_name}来引用。2.创......
  • mysql忘记密码的终极解决方案(docker-compose).211216
    MYSQL8的安全性能有所提高,装好后,各种不适应,需要各种调试。1.首先,root密码忘记或是更改,操作步骤:vimysql/config/my.cnf在[mysqld]的段中加上一句:skip-grant-tables=1保存并且退出vi。2.docker-composerestart进入bash,运行mysql-uroot-p,回车,直接进入。下面很重要,特别......
  • 10.16
    数据结构◆无向图:图的结点之间连接线是没有箭头的,不分方向。◆有向图:图的结点之间连接线是箭头,区分A到B,和B到A是两条线。◆完全图:无向完全图中,节点两两之间都有连线,n个结点的连线数为(n·1)+(n-2)+.+1=n*(n-1)/2;有向完全图中,节点两两之间都有互通的两个箭头,n个节点的连线数......
  • 洛谷题单指南-线段树的进阶用法-P4093 [HEOI2016/TJOI2016] 序列
    原题链接:https://www.luogu.com.cn/problem/P4093题意解读:一个序列,m个变化,求任意一个变化后不受影响的最长上升子序列长度。解题思路:设原序列为a[N],原序列经过变化后能得到的最大值序列为maxa[N],最小值序列为mina[N]设f[i]表示以第i个数结尾的最长不降子序列长度有f[i]=max......
  • Xcode 批量修改文件名称前缀
    这里只记录修改文件名称,不是修改项目名称 修改xcodeproj选择旧name.xcodeproj右键显示包内容双击打开project.pbxprojcommand+F全局搜索旧name进行替换。 批量更改前缀下载python3下载地址:https://www.python.org/downloa......
  • 1688商品类目API接口的开发应用与收益
    在电子商务领域,数据的获取与分析是企业决策的关键。阿里巴巴旗下的1688平台,作为全球领先的B2B在线交易市场,提供了丰富的API接口,助力企业高效获取商品信息,优化供应链管理,提升市场竞争力。本文将深入探讨1688商品类目API接口的开发应用,结合实际案例,展示其为企业带来的显著收益,并......
  • Python爬虫与1688图片搜索API接口:深度解析与显著收益
     在电子商务的浩瀚海洋中,数据是驱动业务决策的核心引擎。阿里巴巴旗下的1688平台,作为全球领先的B2B在线市场,不仅汇聚了海量的商品信息,还提供了丰富的API接口,为开发者提供了强大的数据获取工具。本文将深入探讨1688图片搜索API接口,通过Python爬虫技术的结合,展示如何高效利用这......
  • P8037 [COCI2015-2016#7] Prokletnik 题解
    题意定义一个区间$l,r$为好的当且仅当最小值为$a_l$且最大值为$a_r$或最大值为$a_l$且最小值为$a_r$。我们先考虑最小值为$a_l$且最大值为$a_r$的,另一个我们翻转过来在搞一遍就好了。先考虑将询问离线按$r$排序,容易发现,对于每个右端点$r$对应的合法左端点是......