46

I have built my App (targeted for iOS7) and now want to apply Google Analytics as the last step before submission. What I did:

  1. Downloaded GA for iOS 3.01
  2. Imported content of /GoogleAnalytics/Library/ into group "GoogleAnalytics"
  3. Imported libGoogleAnalyticsServices.a into group "GoogleAnalytics"
  4. Added Build Phases and swapped build phase libGoogleAnalytics_debug.a with libGoogleAnalyticsServices.a
  5. Added code block #include "GAI.h" to my -Prefix.pch-file.
  6. Initialize the [GAI sharedInstance] in my AppDelegate.

I have attached screenshots of the setup in the bottom of this post. When I try to build (either device or simulator, both 32bit), I get the following linker errors:

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

How do I solve this?

UPDATE 1

I also get the warning

ld: warning: ignoring file .../libGoogleAnalyticsServices.a, missing required architecture x86_64 in file .../libGoogleAnalyticsServices.a (3 slices)
ld: warning: ignoring file .../SDWebImage.framework/SDWebImage, missing required architecture x86_64 in file .../SDWebImage.framework/SDWebImage (3 slices)

UPDATE 2

This error only occurs when building for 64bit. I had accidentally set "Build Only for active architectures" to NO, when this changed to YES, I was able to build yet again. This means that the App now does NOT work on iPhone 5S - which is still a problem.

casparjespersen
  • 3,460
  • 5
  • 38
  • 63

4 Answers4

70

You're not doing anything wrong. I'm pretty sure google has not yet provided a arm64 version of their libGoogleAnalyticsServices.a, which is really annoying ...it has been weeks since the public the release of Xcode 5GM.

For now, I guess only build for armv7, armv7s or remove google analytics until they get their head out of their pants.

UDATE: Finally fixed https://developers.google.com/analytics/devguides/collection/ios/resources

Ryan Romanchuk
  • 10,819
  • 6
  • 37
  • 41
  • So, if I build for armv7, armv7s than app will not run on Phone 5S. Or I can build it for Phone 5S, but that I will not have ads. – WebOrCode Oct 24 '13 at 04:06
  • 1
    It will run on iPhone 5S just fine, you just won't be utilizing the arm64 64bit architecture available on the phone. – Ryan Romanchuk Oct 24 '13 at 07:54
  • 1
    @Karthik i remember SD actually works, it was one of the dependency libraries, and it was fixable, let me look to see how I fixed the build. – Ryan Romanchuk Dec 18 '13 at 00:56
  • For now I fixed by removing arm64 from build sittings and all my libraries works. But thanks for your help. – Karthik Dec 18 '13 at 10:18
13

Select this option in the Architecture section in "Build Settings" and your code will run on iPhone 5S, I had the same trouble.

Build Settings

pabloverd
  • 614
  • 8
  • 8
8

Good news everyone, fixed by the 3.03 release:

64-bit support is now available in v3.03 of the Google Analytics Services SDK for iOS. (Source)

Sven
  • 1,450
  • 3
  • 33
  • 58
Ali
  • 18,665
  • 21
  • 103
  • 138
0

I see on first screenshot that your project has 2 targets. Are you sure that libGoogleAnalyticsServices.a added to both targets? Linked frameworks may differ from target to target, so it's most common error this way... Also try remove GA from project, then Clean, then Clean Build Folder, then restart Xcode and add GA again =) Yesterday this helped me =)

Petro Korienev
  • 4,007
  • 6
  • 34
  • 43
  • Thanks for the suggestion, Petro. However, I just tried it and it does not help. And I am 100% certain that the files are added to the correct target. – casparjespersen Sep 21 '13 at 17:43
  • 7
    Just a note for your update2, x86_64 isn't actually iPhone 5s architecture. It's arm64. In your target architectures you can select "Standard architectures (including 64-bit)" for generating two binaries - for 32 and for 64bit iOS. However, if you build with "Standard architecures" (armv7, armv7s) your app will still work on iPhone 5s - just without 64bit processing performance boost. Also, i think GA static lib isn't yet built for both 32 and 64bit iOS and you will get errors like "undefined symbol for arch arm64". – Petro Korienev Sep 22 '13 at 10:58