22

I have created a new iOS project and added Google Analytics support following by official instructions.

I've added to Frameworks:

libGoogleAnalyticsServices.a
AdSupport.framework
CoreData.framework
SystemConfiguration.framework
libz.dylib

But it doesn't work with the errors:

ld: warning: directory not found for option '-L/Users/.../Sources/GoogleAnalytics'
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
      objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
  "_OBJC_CLASS_$_NSAttributeDescription", referenced from:
      objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
  "_OBJC_CLASS_$_NSEntityDescription", referenced from:
      objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
      objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
  "_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
      objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
  "_OBJC_CLASS_$_NSFetchRequest", referenced from:
      objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
  "_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
      objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
  "_NSSQLiteErrorDomain", referenced from:
      -[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
  "_NSSQLiteStoreType", referenced from:
      -[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
  "_NSOverwriteMergePolicy", referenced from:
      -[GAIDataStore contextWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can I fix it? And does it support arm64?

Dmitry
  • 14,306
  • 23
  • 105
  • 189
  • chk this http://stackoverflow.com/questions/6429494/undefined-symbols-for-architecture-armv7 – Aman Aggarwal Feb 25 '14 at 08:50
  • 1
    Have you added all require frameworks? – Gaurav Feb 25 '14 at 08:50
  • Aman, it doesn't help. – Dmitry Feb 25 '14 at 08:55
  • Gaurav, what frameworks are required? I've added all of them following official and unofficial instructions! – Dmitry Feb 25 '14 at 08:56
  • 1
    From this errors: "_OBJC_CLASS_$_NSFetchRequest", referenced from: objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o) "_OBJC_CLASS_$_NSManagedObjectContext", referenced from: ... It looks like you have missed adding Core Data frameworks.. – Gaurav Feb 25 '14 at 09:01

3 Answers3

47

From Google Analytics developer page

The Google Analytics SDK uses the CoreData and SystemConfiguration frameworks, so you will need to add the following to your application target's linked libraries:

  • libGoogleAnalyticsServices.a
  • AdSupport.framework
  • CoreData.framework
  • SystemConfiguration.framework
  • libz.dylib

Looks like you are missing out CoreData.framework.


Running the lipo -info command on the GA library.

xcrun -sdk iphoneos lipo -info libGoogleAnalyticsServices.a

Gives result,

Architectures in the fat file: libGoogleAnalyticsServices.a are: armv7 armv7s i386 x86_64 arm64 

So it does support arm64.

Hope that helps!

Community
  • 1
  • 1
Amar
  • 13,202
  • 7
  • 53
  • 71
12

Thanks for all! The following steps helped me:

  1. Remove CoreData.framework.
  2. Add again CoreData.framework.

arm64 is now supported. Thanks to Amar.

Now I should fix the last warning:

ld: warning: directory not found for option '-L/Users/.../Sources/GoogleAnalytics'

It happens because I work with the project on different users.

Dmitry
  • 14,306
  • 23
  • 105
  • 189
4

You should add the libsqlite3.0.dylibfile to your frameworks.

To do this, under the projects target, on the general tab, you will find "Linked Frameworks and Libraries", just select the '+' button, and add the framework from there

Mthokozisi
  • 171
  • 2
  • 12