gpt4 book ai didi

ios - 更新到React Native 0.60+之后未链接动态库

转载 作者:行者123 更新时间:2023-12-01 21:59:15 24 4
gpt4 key购买 nike

更新到React Native 0.61.5后,我在链接只能动态链接的库时遇到了问题(@react-native-mapbox-gl/maps)。

解决方案通常是在Podfile中启用动态库(设置use_frameworks!)。但是,这样会使所有库动态化,并导致只能静态链接的库出现问题(react-native-firebase)。

是否有满足这些冲突要求的解决方案?

设置use_frameworks!时,将在运行时引发此错误:

dyld: Library not loaded: @rpath/MapboxMobileEvents.framework/MapboxMobileEvents
Referenced from: /private/var/containers/Bundle/Application/4A4F5BC3-2A1D-4949-9423-71EF7EFE79FD/ImmoWert2Go.app/Frameworks/Mapbox.framework/Mapbox
Reason: image not found

未设置 use_frameworks!时, pod install引发以下错误:
[!] The 'Pods-ImmoWert2Go' target has transitive dependencies that include statically linked binaries: (FirebaseCore, FirebaseCoreDiagnostics, GoogleDataTransportCCTSupport, GoogleDataTransport, and FirebaseInstanceID)

最佳答案

@react-native-mapbox-gl/maps当前无法作为静态库使用,因此需要将整个项目配置为使用动态库,Apple不建议这样做。

解决方案是在Podfile的开头添加以下行:

# Set libraries as dynamic by default
use_frameworks!

# Set specific libraries as static (react-native-firebase)
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name.start_with?('RNFB')
def pod.build_type;
Pod::Target::BuildType.static_library
end
end
end
end

完成此操作后,就需要修补 RNFirebaseUtil.h
#import <Firebase.h>


#import "Firebase.h"

关于ios - 更新到React Native 0.60+之后未链接动态库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60545463/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com