React-native-wechat: RN 0.60 iOS 无法运行起来

Created on 15 Aug 2019  ·  12Comments  ·  Source: yorkie/react-native-wechat

System:
    OS: macOS 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 142.18 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.3.1 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.10.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 21, 23, 26, 27, 28
      Build Tools: 23.0.1, 26.0.1, 28.0.3
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.5 => 0.60.5
  npmGlobalPackages:
    react-native-cli: 2.0.1

复现步骤

yarn add react-native-wechat 
react-native link react-native-wechat



md5-70aa5c53cc5b44ac1c6a4b76d466137b



cd ios
pod install



md5-70aa5c53cc5b44ac1c6a4b76d466137b



Analyzing dependencies
Fetching podspec for `RCTWeChat` from `../node_modules/react-native-wechat`
[!] No podspec found for `RCTWeChat` in `../node_modules/react-native-wechat`



md5-15015eb6ffdf4faae80608a58e9e1bae



ld: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Fra
meworks/XCTest.framework/XCTest' does not contain bitcode. You must rebuild it with bitcode 
enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable
 bitcode for this target. file 
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Fra
meworks/XCTest.framework/XCTest' for architecture arm64

Most helpful comment

@jameshuimin @wanghhh

  1. 建议 package.json 先使用 "react-native-wechat": "yorkie/react-native-wechat#master" 重新安装。

    1. 进入 项目的 ios 目录下使用 CocoaPods 重新安装一下依赖:

      cd /ios

      pod install

All 12 comments

按照网上的提供的解决方案,在我的项目中的Build Settings中将Enable Bitcode 设置为 NO,再次运行,报错:

 Undefined symbol: _OBJC_CLASS_$_BaseReq

 Undefined symbol: _OBJC_CLASS_$_BaseResp

Undefined symbol: _OBJC_CLASS_$_PayReq

image

按照https://github.com/yorkie/react-native-wechat/pull/499PR 是能跑起来了,但是,JS报错:
调用WeChat.registerApp('appid');
报错:

Cannot read property 'registerApp' of undefined

看起来是xcode配置的问题

我发现了,那个 master branch 已经修好了。他们写了一个新的 .podspec

package.json

"react-native-wechat": "yorkie/react-native-wechat#master"

用那版本就没问题了。不知道为什么一年多还没发布新的 npm 版本。


我也跟你报错一样,楼主解决了吗

按照网上的提供的解决方案,在我的项目中的Build Settings中将Enable Bitcode 设置为 NO,再次运行,报错:

 Undefined symbol: _OBJC_CLASS_$_BaseReq

 Undefined symbol: _OBJC_CLASS_$_BaseResp

Undefined symbol: _OBJC_CLASS_$_PayReq

image

你解决了吗

同样的错误,怎么解决的

@jameshuimin @wanghhh

  1. 建议 package.json 先使用 "react-native-wechat": "yorkie/react-native-wechat#master" 重新安装。

    1. 进入 项目的 ios 目录下使用 CocoaPods 重新安装一下依赖:

      cd /ios

      pod install

确实有效

@jameshuimin @wanghhh

  1. 建议 package.json 先使用 "react-native-wechat": "yorkie/react-native-wechat#master" 重新安装。
  2. 进入 项目的 ios 目录下使用 CocoaPods 重新安装一下依赖:
    cd /ios
    pod install

这个方法目前有效

当前版本的小程序分享可以使用了吗
我目前使用的是react-native-wechat-with-miniprogram-share,不支持0.60+

当前版本的小程序分享可以使用了吗
我目前使用的是react-native-wechat-with-miniprogram-share,不支持0.60+

@sunlei4076 Hi, 当前版本不支持小程序分享,下一个 major 版本会支持,目前该 pr 还在开发测试阶段。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vinkugor picture Vinkugor  ·  4Comments

xclidongbo picture xclidongbo  ·  4Comments

shiguoqing picture shiguoqing  ·  8Comments

lixunn picture lixunn  ·  6Comments

midas-gufei picture midas-gufei  ·  5Comments