Adding Google_analytics for iOS is not working tri

2019-02-16 20:38发布

Hi I'm getting following error and so far not able to fix it.

Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GAI", referenced from:
  objc-class-ref in AppDelegate.o objc-class-ref in HomeViewController.o  "_OBJC_CLASS_$_GAITrackedViewController", referenced from: _OBJC_CLASS_$_HomeViewController in HomeViewController.o "_OBJC_METACLASS_$_GAITrackedViewController", referenced from: _OBJC_METACLASS_$_HomeViewController in HomeViewController.o ld: symbol(s) not found for architecture x86_64

Any help would be appreciated. Thanks in advance !

4条回答
仙女界的扛把子
2楼-- · 2019-02-16 20:56

The suggestion here worked for me to add both libGoogleAnalyticsServices.a and libsqlite3.0.dylib. I am building a swift project and would upvote answer 1 if I had the privileges.

查看更多
太酷不给撩
3楼-- · 2019-02-16 20:59

I have tried reproducing the issue that you've been facing and ended up with the same error you got. But, I was able to fix it. What I have done is, I have added the file libGoogleAnalyticsServices.a from the SDK folder to my project. Then, I added libsqlite3.0.dylib to the Link Binary With Libraries in the Build Phases tab. It worked!!!!

PS: Make sure you've added all the headers and mentioned frameworks in your project. The key is to include libGoogleAnalyticsServices.aand libsqlite3.0.dylib.

查看更多
仙女界的扛把子
4楼-- · 2019-02-16 21:10

For me the problem is solved by the following steps:

pod init

Open Podfile paste the following lines(Change the Projectname to your project name)

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'Projectname' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  use_frameworks!


  # Pods for Projectname
  pod 'GoogleAnalytics'

  target 'ProjectnameTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ProjectnameTests' do
    inherit! :search_paths
    # Pods for testing
  end

end
查看更多
ゆ 、 Hurt°
5楼-- · 2019-02-16 21:19

Had same problem till I added the libGoogleAnalyticsServices.a and libsqlite3.0.dylib to "Link Binary with Libraries"

Here is my full list:

enter image description here

查看更多
登录 后发表回答