user1781040
user1781040

Reputation: 291

Google Analytics Library IOS

When i add google analytics library, i have this warning

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_NSAttributeDescription", referenced from:
      objc-class-ref in libGoogleAnalytics.a(GAICoreDataUtil.o)
      objc-class-ref in libGoogleAnalytics_debug.a(GAICoreDataUtil.o)
  "_OBJC_CLASS_$_NSFetchRequest", referenced from:
      objc-class-ref in libGoogleAnalytics.a(GAIDataStore.o)
      objc-class-ref in libGoogleAnalytics_debug.a(GAIDataStore.o)
  "_NSSQLiteErrorDomain", referenced from:
      l003 in libGoogleAnalytics.a(GAIDataStore.o)

Please help me

Upvotes: 18

Views: 19789

Answers (11)

mask
mask

Reputation: 6222

I followed all suggestions and I was still getting an error on XCODE 5.1.1.

For me the error was in target > Build Setting > Architecture > Architectures.

I replaced the value with ARCHS_STANDARD_32_BIT and the error was gone.

Maybe the libGoogleAnalytics lib was not compiled for 64 BIT architecture.

Hope this will help someone. Or get latest lib which is compiled for 64 Bit.

Upvotes: 0

Krešimir Prcela
Krešimir Prcela

Reputation: 4281

If using Cocoapods make sure Other linker flags has only $(inherited) flag and remove any child architecture flags.

For framework search paths and Library search paths also set only $(inherited) flag.

Inside the header bridging file put the #import <Google/Analytics.h>

Upvotes: 0

imba_man
imba_man

Reputation: 81

I followed this tutorial. It says to add

#import "GAI.h"
#import "GAIFields.h"

into the NameofTheProject-Prefix.pch file.

And additionally to CoreData.framework and SystemConfiguration.framework add libz.dylib It solved all issues.

Upvotes: 4

jki
jki

Reputation: 4791

Add libGoogleAnalytics.a to your target setting [Build phases]-[Link Binary with Libraries]. Also check if libsqlite3.0dylib (where GA stores tracking data) and CFNetwork.framework are added there as they are required for Google Analytics/iOS (version 2.0 beta 3).

P.S. For Google Analytics/iOS version 3.0 CoreData framework is required instead.

Upvotes: 41

Naka
Naka

Reputation: 1058

Add -lGoogleAnalyticsServices in Build settings -> Other Linker Flags

Upvotes: 7

mnazwan
mnazwan

Reputation: 11

Had similar issue after migrating to SDK 2.0 beta 4. Resolved by removing old GA library path from My Build Settings > Library Search Paths as pointed by Adri.

Upvotes: 0

Jacksonkr
Jacksonkr

Reputation: 32207

I had an ODD odd issue. For some reason libGoogleAnalytics.a was in Copy Bundle Resources when it was supposed to be in Link Binary With Libraries

Hopefully that helps someone.

Upvotes: 0

Jamal Zafar
Jamal Zafar

Reputation: 2189

I was having this issue because i didn't add the libGoogleAnalytics_debug.a file. The problem just got resolved as i added this file and built the project again.

Upvotes: 3

stevel
stevel

Reputation: 1622

I had similar errors as above, actually more (SDK 2.0 beta 4). After adding the Analytics library/headers, linking with these two frameworks solved the issues:

CoreData.framework and SystemConfiguration.framework

Upvotes: 6

Agat
Agat

Reputation: 4779

Problem related to Google Analytics SDK for iOS v2 migration.

I am not sure which topic to write it to as there is no exact problem--I've bumped into and solved by my own--found (this one seems to be the closest (not sure if I should open a new one)), but might be helpfull for someone.

Problem:

I have my previous (1.5.1) SDK installed in "SDKs/GoogleAnalytics SDK" separate folder. On v2 migration I've placed the new files into "SDKs/GoogleAnalytics SDK v2". After following all the instructions about migration (from Google site) (and, in details, that was just removing the previous references to the files from the first folder and adding the new ones from the new one), I started to get the following error message on compilation:

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

I went trough first pages of googling (and stackoverflowing) and the most popular solution suggested was "to set 'Build active architecture only' property to 'YES'" (my active architectures are "armv7 armv7s"). But that DID NOT HELP at all.

Solution:

However, a miracle happened. I've noticed that there is an old directory "SDKs/GoogleAnalytics SDK" was listed in linker pathes. So, after that directory removing (as I don't know where the list of the directories exists in settings) everything started to compile and work like a charm (also setting 'Build active architecture only' to 'YES' was not necessary for me).

Upvotes: 9

plop91
plop91

Reputation: 131

I had have the same issue on NSAttributeDescription. In documentation this function is from CoreData.framework, so I have added this framework and no more errors on that issue.

Upvotes: 13

Related Questions