在Flutter開發(fā)項(xiàng)目中APP想實(shí)現(xiàn)新功能,所以需要接入新的第三方插件,但是有些第三個(gè)的Dart SDK版本要求很高矗愧,所以不得不升級(jí)Flutter SDK梯醒。于是索性把FLutter SDK升級(jí)到最新的3.X.X版本宽堆,然后遇到了iOS運(yùn)行時(shí)找不到Swift動(dòng)態(tài)庫的問題:
dyld[4083]: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: <9E270ED6-633F-3B50-95FF-9714EDA68D6B> /Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containers/Bundle/Application/EF9F975D-C9E7-4E8C-BF18-2599885B7833/Runner.app/Runner
Reason: tried: '/Users/cyclonecat/Library/Developer/Xcode/DerivedData/Runner-cthezlxggpeeajfjbmnhvhiwfscy/Build/Products/Debug-iphonesimulator/libswiftCore.dylib' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection/libswiftCore.dylib' (errno=2), '/Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containers/Bundle/Application/EF9F975D-C9E7-4E8C-BF18-2599885B7833/Runner.app/Frameworks/libswiftCore.dylib' (errno=2), '/Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containers/Bundle/Application/EF9F975D-C9E7-4E8C-BF18-2599885B7833/Runner.app/Frameworks/libswiftCore.dylib' (errno=2), '/Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containers/Bundle/Application/EF9F975D-C9E7-4E8C-BF18-2599885B7833/Runner.app/Frameworks/libswiftCore.dylib' (errno=2), '/Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containers/Bundle/Application/EF9F975D-C9E7-4E8C-BF18-2599885B7833/Runner.app/Frameworks/libswiftCore.dylib' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libswiftCore.dylib' (errno=2)
Library not loaded: @rpath/libswiftCore.dylib
Referenced from: <9E270ED6-633F-3B50-95FF-9714EDA68D6B> /Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containers/Bundle/Application/EF9F975D-C9E7-4E8C-BF18-2599885B7833/Runner.app/Runner
Reason: tried: '/Users/cyclonecat/Library/Developer/Xcode/DerivedData/Runner-cthezlxggpeeajfjbmnhvhiwfscy/Build/Products/Debug-iphonesimulator/libswiftCore.dylib' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection/libswiftCore.dylib' (errno=2), '/Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containers/Bundle/Application/EF9F975D-C9E7-4E8C-BF18-2599885B7833/Runner.app/Frameworks/libswiftCore.dylib' (errno=2), '/Users/cyclonecat/Library/Developer/CoreSimulator/Devices/638BCD07-E6BD-4978-BA3C-A4F36DD2C849/data/Containe
dyld config: DYLD_SHARED_CACHE_DIR=/Users/cyclonecat/Library/Developer/CoreSimulator/Caches/dyld/21G115/com.apple.CoreSimulator.SimRuntime.iOS-16-0.20A360 DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/cyclonecat/Library/Developer/Xcode/DerivedData/Runner-cthezlxggpeeajfjbmnhvhiwfscy/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/cyclonecat/Library/Developer/Xcode/DerivedData/Runner-cthezlxggpeeajfjbmnhvhiwfscy/Build/Products/Debug-iphonesimulator DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib
(lldb)
通過百度找到了這遍dyld:Library not loaded: @rpath/libswiftCore.dylib文章,但不能解決冤馏。
后面又找到了下面的方法日麸,成功解決這個(gè)問題。
在項(xiàng)目的TARGETS下Runner的Build Settings->Linking->Runpath Search Paths配置添加/usr/bin/swift
和/usr/lib/swift
逮光,如下圖:
然后成功運(yùn)行代箭。
參考文章:
dyld:Library not loaded: @rpath/libswiftCore.dylib(這個(gè)不適用Flutter)
Flutter ‘/usr/lib/libswiftCore.dylib‘ (no such file)
flutter各種問題