架构armv7的未定义符号:“_objc_class_$ _GGLContext”,引用自:objc-class-ref在AppDelegate.o中。

时间:2021-09-29 15:19:49

I am trying to add Google Analytics in my iSO app and I am using Google Analytics latest SDK https://developers.google.com/analytics/devguides/collection/ios/v3/.

我正在尝试在我的iSO应用程序中添加谷歌分析,我正在使用谷歌分析最新SDK https://developers.google.com/analytics/devguides/collection/ios/v3/。

Added all required header and frameworks to my project successfully. But while running my app I am getting below errors

将所有需要的标题和框架添加到我的项目中。但是,在运行我的应用程序时,我正在犯错误。

  1. (null): "_OBJC_CLASS_$_GGLContext", referenced from:objc-class-ref in AppDelegate.o

    (null):“_objc_class_$ _GGLContext”,引用自:objc-class-ref在AppDelegate.o中。

  2. (null): Linker command failed with exit code 1 (use -v to see invocation)

    (null):链接器命令失败,退出代码1(使用-v查看调用)

Below is the code which I am writtig in AppDelegate.m file

下面是我在AppDelegate中写入的代码。m文件

// Configure tracker from GoogleService-Info.plist.
NSError *configureError;
[[GGLContext sharedInstance] configureWithError:&configureError];
NSAssert(!configureError, @"Error configuring Google services: %@", configureError);

// Optional: configure GAI options.
GAI *gai = [GAI sharedInstance];
gai.trackUncaughtExceptions = YES;  // report uncaught exceptions
gai.logger.logLevel = kGAILogLevelVerbose;  // remove before app release

Also includes (_OBJC_CLASS_$_GIDSignInButton and _OBJC_CLASS_$_GIDSignIn) Please tell what I am missing. Thanks in advance.

还包括(_objc_class_$ _GIDSignInButton和_objc_class_$ _GIDSignIn),请告知我所缺少的内容。提前谢谢。

6 个解决方案

#1


40  

"The OPN [Debug] target overrides the OTHER_LDFLAGS build setting". This was the main issue. After adding $(inherited) in new line in other linker flags solved my issue.

“OPN[调试]目标覆盖其他_ldflags构建设置”。这是主要问题。在其他链接器的新行中添加$(继承)之后,就解决了我的问题。

#2


7  

if you are using pod to install the libraries like the link suggests, make sure you check whether there are any errors when you run pod install. It could be that you have changed the OTHER_CFLAGS or OTHER_LDFLAGS in the build settings, that could lead to problem. If that's the case you probably want to add "$(inherited)" in a new line to both those flags.

如果您使用pod来安装类似链接建议的库,请确保在运行pod安装时检查是否存在错误。可能是您在构建设置中更改了OTHER_CFLAGS或OTHER_LDFLAGS,这会导致问题。如果是这样的话,您可能希望在这两个标记的新行中添加“$(继承)”。

#3


2  

Looks like you're not linking-in one of the Google libraries; I guess Analytics.

看起来你并没有链接到谷歌的一个库中;我想分析。

#4


2  

Try add libGGLCore.a and libGGLAnalytics.a to Link Binary with Libraries

尝试添加libGGLCore。一个和libGGLAnalytics。a与库链接二进制文件。

#5


0  

A small mistake and Google SDK doesn't work. I am new in CocoaPods and I didn't know, that you must add google analytics pod inside your target. Like this:

一个小错误和谷歌SDK不起作用。我在CocoaPods是新手,我不知道,你必须在你的目标中加入谷歌分析pod。是这样的:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!   

target 'NAME_OF_THE_TARGET' do
  pod 'Google/Analytics'
end

#6


0  

This happened to me when I set up a development target. The production target was working fine but the development kept bringing up those errors. My issue was in the pod file. At first:

当我设定一个发展目标时,我就遇到了这种情况。生产目标运行良好,但开发过程中不断出现错误。我的问题是在pod文件中。首先:

target 'NAME-OF-TARGET' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for MAIN-TARGET
pod 'GoogleSignIn'
pod 'Firebase/Core'
pod 'Firebase/Database'

target 'DEV TARGET' do
    inherit! :search_paths           <----------
    # Pods for dev-target
    pod 'GoogleSignIn'
    pod 'Firebase/Core'
    pod 'Firebase/Database'
end

The line I have indicated the arrow was the issue. I changed it from inherit! :search_paths to use_frameworks! and the errors were done.

我标出的线是这个问题。我改变了它的继承!:search_paths use_frameworks !错误就完成了。

#1


40  

"The OPN [Debug] target overrides the OTHER_LDFLAGS build setting". This was the main issue. After adding $(inherited) in new line in other linker flags solved my issue.

“OPN[调试]目标覆盖其他_ldflags构建设置”。这是主要问题。在其他链接器的新行中添加$(继承)之后,就解决了我的问题。

#2


7  

if you are using pod to install the libraries like the link suggests, make sure you check whether there are any errors when you run pod install. It could be that you have changed the OTHER_CFLAGS or OTHER_LDFLAGS in the build settings, that could lead to problem. If that's the case you probably want to add "$(inherited)" in a new line to both those flags.

如果您使用pod来安装类似链接建议的库,请确保在运行pod安装时检查是否存在错误。可能是您在构建设置中更改了OTHER_CFLAGS或OTHER_LDFLAGS,这会导致问题。如果是这样的话,您可能希望在这两个标记的新行中添加“$(继承)”。

#3


2  

Looks like you're not linking-in one of the Google libraries; I guess Analytics.

看起来你并没有链接到谷歌的一个库中;我想分析。

#4


2  

Try add libGGLCore.a and libGGLAnalytics.a to Link Binary with Libraries

尝试添加libGGLCore。一个和libGGLAnalytics。a与库链接二进制文件。

#5


0  

A small mistake and Google SDK doesn't work. I am new in CocoaPods and I didn't know, that you must add google analytics pod inside your target. Like this:

一个小错误和谷歌SDK不起作用。我在CocoaPods是新手,我不知道,你必须在你的目标中加入谷歌分析pod。是这样的:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!   

target 'NAME_OF_THE_TARGET' do
  pod 'Google/Analytics'
end

#6


0  

This happened to me when I set up a development target. The production target was working fine but the development kept bringing up those errors. My issue was in the pod file. At first:

当我设定一个发展目标时,我就遇到了这种情况。生产目标运行良好,但开发过程中不断出现错误。我的问题是在pod文件中。首先:

target 'NAME-OF-TARGET' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for MAIN-TARGET
pod 'GoogleSignIn'
pod 'Firebase/Core'
pod 'Firebase/Database'

target 'DEV TARGET' do
    inherit! :search_paths           <----------
    # Pods for dev-target
    pod 'GoogleSignIn'
    pod 'Firebase/Core'
    pod 'Firebase/Database'
end

The line I have indicated the arrow was the issue. I changed it from inherit! :search_paths to use_frameworks! and the errors were done.

我标出的线是这个问题。我改变了它的继承!:search_paths use_frameworks !错误就完成了。