Swift dyld:库未加载 - 使用CocoaPods

时间:2021-09-08 21:52:07

I apologize for what may seem like an overly asked question, but no matter how many answers to related questions I'm asking, none of them seem to work. See (in order) here, here, here, and here.

我为一个看似过度问题的问题道歉,但不管我问的相关问题有多少答案,它们似乎都没有用。请参阅(按顺序)此处,此处,此处和此处。

I'm running Xcode 6.4 with iOS 8 (iPhone only), using CocoaPods. Many of other answers provided, there seems to be a build setting, or general setting that does not exist in my version of Xcode, yielding many conclusions not helpful.

我使用CocoaPods运行Xcode 6.4和iOS 8(仅限iPhone)。提供了许多其他答案,似乎有一个构建设置,或者我的Xcode版本中不存在的一般设置,产生了许多无用的结论。

As a matter of reference, I followed This CocoaPods Tutorial which worked with ease. But it's only when I attempt to load the app onto my phone (yes, I have valid certificates, and my other apps work just fine without using other dependencies), the app immediately crashes just as it's about to load.

作为参考,我按照这个CocoaPods教程轻松工作。但只有当我尝试将应用程序加载到手机上时(是的,我有有效的证书,而我的其他应用程序工作正常而不使用其他依赖项),应用程序会立即崩溃,就像它即将加载一样。

dyld: Library not loaded: @rpath/Pods_ExamplePods.framework/Pods_ExamplePods
Referenced from: /private/var/mobile/Containers/Bundle/Application/F109A377-3EA4-48C2-9042-CB6C384C9F30/ExamplePods.app/ExamplePods
Reason: image not found
(lldb) 

See here where I named my app "ExamplePods"

看到这里我将我的应用命名为“ExamplePods”

Swift dyld:库未加载 - 使用CocoaPods

And then here is my Folder Structure, opened in Workspace mode. Note that there's only 3 dependencies.

然后这是我的文件夹结构,在工作区模式下打开。请注意,只有3个依赖项。

Swift dyld:库未加载 - 使用CocoaPods

Then see "General Settings" and "Build Settings"

然后查看“常规设置”和“构建设置”

Swift dyld:库未加载 - 使用CocoaPods

Swift dyld:库未加载 - 使用CocoaPods

I'm at a complete loss, help is much appreciated!

我完全失去了,非常感谢帮助!

3 个解决方案

#1


2  

I see you're also getting a warning. Is the warning something like this?

我看到你也在收到警告。警告是这样的吗?

ld: warning: -weak_framework is treated as -framework when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES). Weak linking may still happen based on availability mark-up in headers

ld:警告:-weak_framework在与-bitcode_bundle(Xcode设置ENABLE_BITCODE = YES)一起使用时被视为-framework。根据标头中的可用性标记,仍可能发生弱链接

If so you should try to keep the framework weak linked and disable bitcode..

如果是这样,你应该尝试保持框架弱链接和禁用bitcode ..

Found this screenshot here. Swift dyld:库未加载 - 使用CocoaPods

在这里找到这个截图。

If that doesn't work try disabling anything else you didn't compile with. Checking for pods update etc.

如果这不起作用,请尝试禁用您未编译的任何其他内容。检查pods更新等

#2


0  

It is a known cocoa pods issue. See https://github.com/CocoaPods/CocoaPods/issues/3903

这是一个已知的可可豆荚问题。请参阅https://github.com/CocoaPods/CocoaPods/issues/3903

You can either downgrade cocoa pods. Or using the methods mentioned the that post: delete "Compatibility version" completely, leave it empty. A simple script can be added to Podfile to automate this:

你可以降级可可豆荚。或者使用该帖子中提到的方法:完全删除“兼容性版本”,​​将其留空。可以将一个简单的脚本添加到Podfile中以自动执行此操作:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        config.build_settings['DYLIB_COMPATIBILITY_VERSION'] = ''
    end
  end
end

Then clean your project and run pod install.

然后清理项目并运行pod install。

#3


-1  

I had the same problem and following solution solved it.

我有同样的问题,以下解决方案解决了它。

In Linked Frameworks and Libraries (in Build Phases), mark Pods.framework to Optional instead of required.

在链接的框架和库中(在构建阶段),将Pods.framework标记为Optional而不是required。

#1


2  

I see you're also getting a warning. Is the warning something like this?

我看到你也在收到警告。警告是这样的吗?

ld: warning: -weak_framework is treated as -framework when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES). Weak linking may still happen based on availability mark-up in headers

ld:警告:-weak_framework在与-bitcode_bundle(Xcode设置ENABLE_BITCODE = YES)一起使用时被视为-framework。根据标头中的可用性标记,仍可能发生弱链接

If so you should try to keep the framework weak linked and disable bitcode..

如果是这样,你应该尝试保持框架弱链接和禁用bitcode ..

Found this screenshot here. Swift dyld:库未加载 - 使用CocoaPods

在这里找到这个截图。

If that doesn't work try disabling anything else you didn't compile with. Checking for pods update etc.

如果这不起作用,请尝试禁用您未编译的任何其他内容。检查pods更新等

#2


0  

It is a known cocoa pods issue. See https://github.com/CocoaPods/CocoaPods/issues/3903

这是一个已知的可可豆荚问题。请参阅https://github.com/CocoaPods/CocoaPods/issues/3903

You can either downgrade cocoa pods. Or using the methods mentioned the that post: delete "Compatibility version" completely, leave it empty. A simple script can be added to Podfile to automate this:

你可以降级可可豆荚。或者使用该帖子中提到的方法:完全删除“兼容性版本”,​​将其留空。可以将一个简单的脚本添加到Podfile中以自动执行此操作:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        config.build_settings['DYLIB_COMPATIBILITY_VERSION'] = ''
    end
  end
end

Then clean your project and run pod install.

然后清理项目并运行pod install。

#3


-1  

I had the same problem and following solution solved it.

我有同样的问题,以下解决方案解决了它。

In Linked Frameworks and Libraries (in Build Phases), mark Pods.framework to Optional instead of required.

在链接的框架和库中(在构建阶段),将Pods.framework标记为Optional而不是required。