React Native iOS构建失败,发生以下错误:体系结构arm64找不到符号

时间:2018-11-25 16:00:44

标签: react-native-ios

嗨,我正在尝试在iOS上构建一个带有react-native-maps的React Native项目。

我的Podfile看起来像这样

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'APP_NAME' do
    # Pods for APP_NAME
    rn_path = '../node_modules/react-native'
    rn_maps_path = '../node_modules/react-native-maps'

    # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
    pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"

    pod 'React', path: rn_path, subspecs: [
        'Core',
        'CxxBridge',
        'DevSupport',
        'RCTActionSheet',
        'RCTAnimation',
        'RCTGeolocation',
        'RCTImage',
        'RCTLinkingIOS',
        'RCTNetwork',
        'RCTSettings',
        'RCTText',
        'RCTVibration',
        'RCTWebSocket',
    ]

    # React Native third party dependencies podspecs
    pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
    pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
    # pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
    pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"


    # react-native-maps dependencies
    pod 'react-native-maps', path: rn_maps_path
    pod 'react-native-google-maps', path: rn_maps_path  # Remove this line if you don't want to support GoogleMaps on iOS
    # pod 'GoogleMaps'  # Remove this line if you don't want to support GoogleMaps on iOS
    # pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS

    # Pods for APP_NAME
    pod 'Firebase/Core', '~> 5.11.0'
    pod 'Firebase/Firestore', '~> 5.11.0'
    pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
    pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'
    pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
    pod 'Interactable', :path => '../node_modules/react-native-interactable'

    target 'APP_NAME-tvOSTests' do
        inherit! :search_paths
        # Pods for testing
        pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'

    end

    target 'APP_NAMETests' do
        inherit! :search_paths
        # Pods for testing
    end

end


post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'react-native-google-maps'
            target.build_configurations.each do |config|
                config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
            end
        end
        if target.name == "React"
            target.remove_from_project
        end
    end
end


target 'APP_NAME-tvOS' do
    # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
    # use_frameworks!

    # Pods for APP_NAME-tvOS

    #target 'APP_NAME-tvOSTests' do
 #   inherit! :search_paths
        # Pods for testing
#  end

end

我每次都会收到以下错误消息。

我尝试了这里列出的所有解决方案 Undefined symbols for architecture arm64

但是他们都没有为我工作。

Undefined symbols for architecture arm64:
  "YGConfig::YGConfig(int (*)(YGConfig*, YGNode*, YGLogLevel, char const*, char*))", referenced from:
      _YGConfigNew in libyoga.a(Yoga.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

1 个答案:

答案 0 :(得分:1)

在将React Native升级到0.58.6时,我遇到了类似的错误

要解决所有symbol not found错误,我必须在xCode中添加/重新添加项目目标Linked frameworks and libraries中有问题的所有库:

enter image description here

我还注意到,对于 RN 0.58 ,在pod文件中不需要任何React或RN依赖项。

有关我的pod文件的更多信息,在这里:

https://stackoverflow.com/a/54999642/1979861

也请在此处检查可能的脚本问题:

https://stackoverflow.com/a/48953119/1979861