Breaking News
Home / iOS / iOS Isuses / Google Analytics CFHostCreateWithName Undefined Error in iOS

Google Analytics CFHostCreateWithName Undefined Error in iOS

Issue

I am integrating Google Analytics into my iOS App using the static lib. However when I compile the project I get the following error:

Ld /Users/mvohra/Library/Developer/Xcode/DerivedData/Funjabi-bjhgzbuvykdpedbfwxkkizchzlgv/Build/Products/Debug-iphonesimulator/Funjabi-iPad.app/Funjabi-iPad normal i386
    cd /Users/mvohra/workspace/projects/iphone/funjabi
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH “/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin”
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/mvohra/Library/Developer/Xcode/DerivedData/Funjabi-bjhgzbuvykdpedbfwxkkizchzlgv/Build/Products/Debug-iphonesimulator -L/Users/mvohra/workspace/projects/iphone/funjabi -F/Users/mvohra/Library/Developer/Xcode/DerivedData/Funjabi-bjhgzbuvykdpedbfwxkkizchzlgv/Build/Products/Debug-iphonesimulator -filelist /Users/mvohra/Library/Developer/Xcode/DerivedData/Funjabi-bjhgzbuvykdpedbfwxkkizchzlgv/Build/Intermediates/Funjabi.build/Debug-iphonesimulator/Funjabi-iPad.build/Objects-normal/i386/Funjabi-iPad.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -lsqlite3 -framework MessageUI -lGoogleAnalytics -o /Users/mvohra/Library/Developer/Xcode/DerivedData/Funjabi-bjhgzbuvykdpedbfwxkkizchzlgv/Build/Products/Debug-iphonesimulator/Funjabi-iPad.app/Funjabi-iPad

Undefined symbols for architecture i386:
  “_CFHostCreateWithName”, referenced from:
      -[GANTCPSocket connect:port:] in libGoogleAnalytics.a(GANTCPSocket.o)
  “_CFStreamCreatePairWithSocketToCFHost”, referenced from:
      -[GANTCPSocket connect:port:] in libGoogleAnalytics.a(GANTCPSocket.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Resolution

Google Analytics lib depends on CFNetwork.framework, so add reference to the CFNetwork.framework and compile your project.

[pb_builder]

Check Also

Signing Identities, Missing Private Key, Cannot sign App

Issue Cannot sign the App in XCode, says Missing Private Key. <!

Leave a Reply