我有一个 IOS swift 应用程序,它使用 2 个 externs 包,1) SwiftKeychainWrapper 和 2) Charts。这两个软件包都已使用“pod”安装,我的 Podfile 如下,
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
pod 'SwiftKeychainWrapper', '~> 3.0'
pod 'Charts'
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
目标“MyAppUITests”执行 继承! :搜索路径 # 用于测试的 Pod 结尾 结束
我使用的是 Xcode 版本 9.2
目录结构如下所示,
MyApp
...
...
Pods
Podfile
Frameworks
iOS
Foundation.framework
Pods
Charts
Core
Support Files
SwiftkeychainWrapper
Products
Target Support Files
在 MyApp 设置下,我看到以下两个有趣的选项卡,
- General
Embedded Binaries
—
Linked Frameworks and Libraries
Name
Pods_MyApp.framework
SwiftKeychainWrapper 和 Charts 都是使用“pod install”安装的。
我还在链接框架和库下添加了“Charts.framework”,但出现了上述错误。我尝试在“Embeddd 部分”下添加“Charts.framework”,但仍然遇到相同的错误。
如果我遵循 https://github.com/danielgindi/Charts 的当前指示其中说以下,
Drag the Charts.xcodeproj to your project
Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework
@import Charts
这表示将其添加到“嵌入式二进制文件”下。如果我这样做,那么“SwiftKeychainWrapper”的构建就会失败。
顺便说一句,当我尝试在我的物理 iphone6 设备上运行它时,会发生此错误。在模拟器上运行正常。我真的不知道如何继续。如有任何帮助,我们将不胜感激。
最佳答案
这原来是由于“证书问题”造成的。在 apple.com 上重新创建新的开发证书后,此问题自行解决。 一个建议是,如果您确实看到类似问题,只需从钥匙串(keychain)访问中删除您的证书并重新创建一个新证书即可。进行干净的构建并运行。
关于Swift dyld : Library not loaded: @rpath/Charts. 框架/图表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48677347/