Xcode/React-native:未定义符号:_swift_getFunctionReplacement

Xcode/React-native : Undefined symbol: _swift_getFunctionReplacement

我有一个 react-native 项目,在我安装了一些与 pods.

相关的 mapbox 之后,我的 xcode 构建开始出现以下错误
ld: warning: building for iOS, but linking in dylib file (/Users/nitinsharma/Library/Developer/Xcode/DerivedData/app-bpqejjqomhurrldtyubqevqtdqzc/Build/Products/Debug-iphoneos/MapboxAccounts.framework/MapboxAccounts) built for Mac Catalyst
Undefined symbols for architecture arm64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

现在,如果我按照这些步骤操作,错误就会消失

 1. Go to project>build settings> library search path
 2. remove "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"

但是之后我无法安装该应用程序,因为当 xcode 尝试在我的设备上安装该应用程序时出现以下错误。我什至尝试删除 DerivedData 文件夹,但没有成功

Details

Unable to install "app"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
--
Could not inspect the application package.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
User Info: {
    DVTRadarComponentKey = 282703;
    MobileDeviceErrorCode = "(0xE8000051)";
    "com.apple.dtdevicekit.stacktrace" = (
    0   DTDeviceKitBase                     0x0000000124ca7c8f DTDKCreateNSErrorFromAMDErrorCode + 220
    1   DTDeviceKitBase                     0x0000000124ce6241 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
    2   DVTFoundation                       0x000000010950764b DVTInvokeWithStrongOwnership + 71
    3   DTDeviceKitBase                     0x0000000124ce5f82 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440
    4   IDEiOSSupportCore                   0x0000000124b56a10 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.292 + 3513
    5   DVTFoundation                       0x000000010963617e __DVT_CALLING_CLIENT_BLOCK__ + 7
    6   DVTFoundation                       0x0000000109637da0 __DVTDispatchAsync_block_invoke + 1191
    7   libdispatch.dylib                   0x00007fff7182e6c4 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x00007fff7182f658 _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x00007fff71834c44 _dispatch_lane_serial_drain + 597
    10  libdispatch.dylib                   0x00007fff718355d6 _dispatch_lane_invoke + 363
    11  libdispatch.dylib                   0x00007fff7183ec09 _dispatch_workloop_worker_thread + 596
    12  libsystem_pthread.dylib             0x00007fff71a89a3d _pthread_wqthread + 290
    13  libsystem_pthread.dylib             0x00007fff71a88b77 start_wqthread + 15
);
}
--


System Information

macOS Version 10.15.6 (Build 19G2021)
Xcode 12.4 (17801) (Build 12D4e)

我正在使用 react native v0.63.0Xcode 12.4,我的设备是 运行 iOS 14.4

Mapbox related pods that are installed

mapbox related pods from my podfile.lock
 - Mapbox-iOS-SDK (6.3.0):
    - MapboxMobileEvents (~> 0.10.4)
 - MapboxAccounts (2.3.1)
 - MapboxCommon (9.2.0)
 - MapboxCoreNavigation (1.2.1):
    - MapboxAccounts (~> 2.3.0)
    - MapboxDirections (~> 1.2.0)
    - MapboxMobileEvents (~> 0.10.2)
    - MapboxNavigationNative (~> 30.0)
    - Turf (~> 1.0)
 - MapboxDirections (1.2.0):
    - Polyline (~> 5.0)
    - Turf (~> 1.0)
 - MapboxMobileEvents (0.10.7)
 - MapboxNavigation (1.2.1):
    - Mapbox-iOS-SDK (~> 6.0)
    - MapboxCoreNavigation (= 1.2.1)
    - MapboxMobileEvents (~> 0.10.2)
    - MapboxSpeech (~> 1.0)
    - Solar (~> 2.1)
 - MapboxNavigationNative (30.0.0):
    - MapboxCommon (= 9.2.0)
 - MapboxSpeech (1.0.0)

我在我的项目中遇到了同样的错误。尝试了这里的一切: https://github.com/react-native-community/upgrade-support/issues/25

最终解决的是将 Project 和 Target 的 Don't Dead-strip Inits and Terms 更改为 Yes