ios - Cocoapods项目设置问题

标签 ios xcode cocoapods

我在 Xcode 8 中的项目设置似乎有问题。问题如下:

添加新的 Pod 时 - 比方说,Pod Firebase - 安装有效,并将必要的文件添加到我的项目中。然后我可以执行 @Import Firebase

到目前为止,一切都很好。但是,一旦我引用了 Firebase API 示例:[FirApp configure]; - 一切仍然正常 - Xcode 上的自动完成功能按预期工作并且没有问题。但是,在构建时我会遇到一个编译时问题,其中指出:

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_FIRAppIndexing", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我能够解决这个问题的唯一方法是在我的项目中手动添加 _FIRAppIndexing.framework,Build settings,在 Link Libraries with Libraries

为此,我只需将框架工作从项目导航器拖放到链接库下的正确部分。

这有时有效;与 Firebase SDK 的其他部分一样,我遇到了运行时崩溃。

因此,为了找到根本原因,我创建了一个全新的测试项目,使用 Pod install 安装了 Pod - 但是我不必添加 framework 手动到图书馆 - 它实际上什至没有在那里列出。

测试项目中的一切在编译和运行时都运行良好。

这让我相信是我的项目设置中的某些东西导致了这种情况。

我尝试过的事情

  • 使用 pod deintegrate 完全删除了 cocoapods 并删除了所有 它的其他痕迹。然后做了一个干净的构建。然后Pod install
  • 将 -objc 添加到链接器标志

播客文件

    # Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'

    target 'MyApp' do
      # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
       use_frameworks!

      # Pods for MyApp
        pod 'Crashlytics'
        pod 'AsyncDisplayKit', '>= 2.0'
        pod 'Firebase'
        pod 'Firebase/Messaging'
        pod 'FBSDKCoreKit'
        pod "HockeySDK", :subspecs => ['AllFeaturesLib']
        pod 'Fabric'
        pod 'FirebaseAppIndexing'
        pod 'AFNetworking', '~> 3.0'
        pod '1PasswordExtension', '~> 1.8.4'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing

  end

end

GitHub 示例项目

https://github.com/TanderZA/MyApp

我复制了我当前的项目 - 并删除了所有文件。问题依然存在。您将看到该项目由于链接器错误而无法编译,并引用了 Firebase AP。 通过手动将框架添加到 Link Libraries with Libraries,您将看到它应该可以编译。但这不是它应该如何工作的。当前项目有一个我没有解决的 infoPlist.strings 问题。但该项目处于演示该问题的状态。

最佳答案

我检查了项目,看来你搞砸了计划。

正确创建一个新方案,然后再次安装 pod,因为项目是 Obj-C,所以您不需要在 podfile 中启用框架。

所以评论像 # use_frameworks!

同时使用 pod update 更新 pod

然后选择新方案并在其中构建项目。

如果您做不到,请告诉我。

关于ios - Cocoapods项目设置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42513899/

相关文章:

ios - 何时使用 show Segues 何时使用 Show detail Segues

ios - XCode 将重复和不正确的图标文件名添加到 Info.plist

ios - 我正在尝试安装 `VLCKit' pod 文件

ios - 我如何检查 cocoa pod 是否有新的测试版?

iphone - 如何在 iphone 中使用 ZipArchive 压缩文件夹?

ios - 我们如何使用 `Button` 添加 `TextField` 和 `SwiftUI`

iphone - 如何在单击某些按钮时重新加载我的 UIViewController?

ios - iOS 中 UITableViewCell 中的 UITableView

ios - iOS 崩溃报告中的 "SIMULATED (this is NOT a crash)"是什么意思?

ios - Xcode 项目无法识别 Podfile 属性