Taro_React Native iOS 错误记录

cd到taro项目根目录,运行yarn install

npm run dev:rn

cd 到 rn_temp目录运行,生成jsbundle,需要在rn_temp目录下新建bundle文件夹

node ../node_modules/react-native/local-cli/cli.js bundle --entry-file ./rn_temp/index.js --bundle-output ./bundle/main.jsbundle --assets-dest ./bundle --dev false --platform ios




问题记录:

1.config.h' file not found

cd node_modules/react-native/third-party/glog-0.3.4

//  第一步。找到路径,进入glog-0.3.4文件里

../../scripts/ios-configure-glog.sh

//  第2步。

2.

报错为

Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]. Extend RCTConvert to support this type.

这个BUG是Xcode.11引起的, 可以查看这个问题的提交记录,链接为:https://github.com/facebook/react-native/issues/25138

我们只需要找到RCTModuleMethod.mm这个文件,大约在93行左右

修改

static BOOL RCTParseUnused(const char **input)

{

  return RCTReadString(input, "__unused") ||

         RCTReadString(input, "__attribute__((__unused__))") ||

         RCTReadString(input, "__attribute__((unused))");

}

这个函数插入    RCTReadString(input, "__attribute__((__unused__))") ||  这行代码重新运行就行了。

3.项目运行无误,Archive出错

Cocoapods下的第三方库libReact.a多个路径

:-1: Multiple commands produce '/Users/***/Library/Developer/Xcode/DerivedData/sentryCpush-cvpqbragxhlzloeebvyoihyauasl/Build/Intermediates.noindex/ArchiveIntermediates/sentryCpush/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libReact.a':

1) Target 'React' has a command with output '/Users/***/Library/Developer/Xcode/DerivedData/sentryCpush-cvpqbragxhlzloeebvyoihyauasl/Build/Intermediates.noindex/ArchiveIntermediates/sentryCpush/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libReact.a'

2) Target 'React' has a command with output '/Users/***/Library/Developer/Xcode/DerivedData/sentryCpush-cvpqbragxhlzloeebvyoihyauasl/Build/Intermediates.noindex/ArchiveIntermediates/sentryCpush/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libReact.a'

解决方法:

在Podfile中添加:

  post_installdo|installer|

    installer.pods_project.targets.eachdo|target|

      # The following is needed to ensure the "archive" step works in XCode.

      # It removes React & Yoga from the Pods project, as it is already included in the main project.

      # Without this, you'd see errors when you archive like:

      # "Multiple commands produce ... libReact.a"

      # "Multiple commands produce ... libyoga.a"

      targets_to_ignore = %w(React yoga)

      iftargets_to_ignore.include? target.name

        target.remove_from_project

      end

    end

  end

然后 pod install 

参考链接:

https://www.jianshu.com/p/804dac985411

4.react-native run-ios --simulator="iPhone 6",运行时指定启动版本

5.'React/RCTBridgeModule.h' file not found

先clean,然后Scheme 选择React 先编译,编译成功后选择项目再次编译

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 2,731评论 0 3
  • iOS学习之深入理解程序编译过程 https://juejin.im/post/5a352bb0f265da433...
    111浪子111阅读 1,845评论 0 2
  • 项目已经迭代了很多版本,目前想在里面集成React native。以下是操作步骤,由于一些坑已经趟过,直接按照解决...
    两个小棉袄阅读 1,284评论 0 4
  • 持续更新中...... 一套企业级的 UI 设计语言和 React 实现。 https://mobile.ant....
    日不落000阅读 5,882评论 0 35
  • 今天阅读了思维导图的书籍,也是入门级的。对思维导图有了初步的认识。因为以前总看别人画思维导图看着挺简单的,实际上学...
    丁香紫_93a7阅读 302评论 0 3