正在通过 Swift Package Manager 安装 Stripe iOS SDK,但由于“库未加载"而崩溃 [英] Stripe iOS SDK via Swift Package Manager is installing, but crashing because "Library not loaded"
问题描述
我使用的是 Xcode 12、iOS 14,一切都正确构建,但是当我安装在设备上并准备运行时,我收到一条消息说dylib:库未加载:"
I am using Xcode 12, iOS 14, everything builds correctly, but when I am installed on the device and about to run, I get a message saying "dylib: Library not loaded:"
dyld: Library not loaded: @rpath/Stripe.framework/Stripe
Referenced from: /private/var/containers/Bundle/Application/31B00354-2E1E-4385-8317-5518588873F7/MyApp.app/MyApp
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
我已尝试通过构建阶段复制框架,但我无法以这种方式复制 Stripe 框架.在我的目标 Frameworks, Libraries and Embedded content
中,Stripe 设置为 Embed &签名
.
I've tried copying the framework via a build phase, but I'm unable to copy the Stripe framework this way. In my targets Frameworks, Libraries and Embedded content
, Stripe is set to Embed & Sign
.
我删除了派生数据、清理了、杀死了 Xcode、重新启动计算机、尝试了不同的 iPhone、不同的 iOS 等等.没有运气.
I've deleted derived data, cleaned, killed Xcode, restart computer, tried different iPhone, with different iOS etc. no luck.
感谢您的帮助.
推荐答案
我需要在 Build Settings 中将 @executable_path/Frameworks
添加到我的 RunPath Search Paths
.
I needed to add @executable_path/Frameworks
to my RunPath Search Paths
in the Build Settings.
@executable_path - 解析为可执行文件的绝对路径,例如./private/var/mobile/Containers/Bundle/Application/0F2C2461-A68B-4ABA-A604-B88E6E9D1BB1/App.app/
@executable_path - resolves to the absolute path of the executable, eg. /private/var/mobile/Containers/Bundle/Application/0F2C2461-A68B-4ABA-A604-B88E6E9D1BB1/App.app/
来自 https://blog.krzyzanowskim.com/
对这些东西的了解比我多 ^
Knows a lot more about this stuff than I do ^
文章(如果它仍然链接):https://blog.krzyzanowskim.com/2018/12/05/rpath-what/
The article (if it still links): https://blog.krzyzanowskim.com/2018/12/05/rpath-what/
这篇关于正在通过 Swift Package Manager 安装 Stripe iOS SDK,但由于“库未加载"而崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!