框架未找到FirebaseAnalytics

时间:2016-06-09 05:54:40

标签: ios objective-c google-analytics firebase-analytics

我将CocoaPod的Google Analytics添加到我的项目中,但我的应用程序崩溃并发出以下错误。

ld: framework not found FirebaseAnalytics
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我该怎么做才能解决这个问题?我按照谷歌的this教程将Google Analytics集成到我的项目中。

12 个答案:

答案 0 :(得分:55)

您可能正在使用cocoapods添加Firebase。确保在目标的构建设置中,调试和发布的“框架搜索路径”均以$(inherited)开头。

您的pod依赖项的构建设置在xcconfig文件中定义,如果目标的构建设置中没有$(inherited),则此文件中的设置将被忽略。

答案 1 :(得分:9)

我遇到了同样的错误,Framework Search Paths中的Build Settings已经设置为$(inherited),用于调试和发布。

我设法用这里的解决方案来解决这个问题: https://stackoverflow.com/a/38246169/1092815

换句话说,Podfile.lock中有一些不好的版本,运行它解决了我的问题:

pod update
pod install

答案 2 :(得分:1)

您需要从项目属性中删除链接的框架。

答案 3 :(得分:1)

我有这个问题并解决了它: - 转到Info.plist - >构建设置 - >框架搜索路径 - 验证/修复路径。就我而言,这是导致问题的额外Fbsdk搜索路径(参见附图) error

我把它改为: fix

答案 4 :(得分:1)

我也遇到了这个问题,并对此进行了解决:

pod deintegrate && pod install

Pod上的CocoaPods文档解整合:https://guides.cocoapods.org/terminal/commands.html#pod_deintegrate

答案 5 :(得分:0)

也许您已经添加了其他框架搜索路径到构建设置,

Step 1: Remove all frame work search path in Build setting
Step 2: run Pod install 
Step 3: Add others Framework search path (That's removed in step 1).

现在运行项目!

答案 6 :(得分:0)

确保在您的Podfile中列出了 import * as jsts from 'jsts/dist/jsts'; const reader = new jsts.io.GeoJSONReader(); const g = reader.read({ 'type': 'Feature', 'geometry': { 'type': 'Polygon', 'coordinates': [ [-4.724834116462489, 48.54429850016129], [-4.806692014663952, 48.35426654640426], [-4.54747533707436, 48.36333181438215], [-4.533832354037941, 48.24535748577782], [-4.724834116462489, 48.54429850016129] ] } }); if (! g.geometry.isValid()) { // Do what you want when error occurs } ;如果未列出pod 'Firebase/Core',则不会安装Firebase/Core

答案 7 :(得分:0)

从Pod(项目)> Pods> FirebaseAnalytics>框架中添加FirebaseAnalytics.framework到项目目标的构建阶段>将二进制文件与库链接。

清理项目,退出Xcode,擦除Derived Data,打开Xcode然后再试一次)

答案 8 :(得分:0)

确保在工作区之前Xcode不会加载您的Xcode项目。作为CocoaPods和工作区的菜鸟,我没有意识到我的工作区未正确加载,因为它仍在Xcode中加载。如果您无法从“工作区资源管理器”窗口中深入研究项目,那就是您的问题。

要解决:

  1. 打开Xcode。
  2. 关闭Xcode中的所有项目和工作区。
  3. 关闭Xcode。
  4. 打开工作区文件

现在,您应该能够正确地构建工作区。

答案 9 :(得分:0)

只需从 project.pbxproj 文件中删除有问题的框架条目。

答案 10 :(得分:0)

尝试更改 Podfile 上的 <?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/standard_spacing" android:layout_marginLeft="@dimen/standard_spacing" android:layout_marginRight="@dimen/standard_spacing" android:layout_marginBottom="@dimen/smaller_spacing" app:cardCornerRadius="@dimen/standard_card_corner_radius" app:cardElevation="10dp"> <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="@dimen/standard_spacing"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="match_parent" app:cardBackgroundColor="@color/light_gray_background" android:minHeight="40dp" app:cardElevation="5dp" app:cardCornerRadius="@dimen/standard_card_corner_radius" > </androidx.cardview.widget.CardView> </androidx.appcompat.widget.LinearLayoutCompat> </androidx.cardview.widget.CardView>

我更新到 11.4 时出现问题。当我改回 platform :ios, '.....' 时,问题就解决了。

不要忘记在编辑 Podfile 后运行 platform :ios, '10.3'

答案 11 :(得分:0)

对我来说,唯一的解决方案是升级我的 Cocoapods gem。

在我的 Gemfile 中,版本是 1.7.3,因此切换到更高版本,当时是 1.10.2,解决了问题。

升级 Gem 后,只需再次运行 pod install

您可以使用 pod --version 命令行检查您的 Cocoapods 版本。