I follow this manual(https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift#get-config) to integrate Google analytics in my app. But i getting some error when i try to test it!
我按照本手册(https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift#get-config)将Google分析整合到我的应用中。但是当我尝试测试时我遇到了一些错误!
ld: framework not found GoogleInterchangeUtilities
I have already made this:
我已经做了这个:
1)in podfile:
pod 'Google/Analytics' -> pod install
2) in APP-Bridging-Header.h:
2)在APP-Bridging-Header.h中:
#import "Google/Analytics.h"
#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIEcommerceFields.h"
#import "GAIEcommerceProduct.h"
#import "GAIEcommerceProductAction.h"
#import "GAIEcommercePromotion.h"
#import "GAIFields.h"
#import "GAILogger.h"
#import "GAITrackedViewController.h"
#import "GAITracker.h"
3) GoogleService-Info.plist already added to my project. But i don't understand what google mean say: "Add GoogleService-Info.plist to each target!!!"
3)GoogleService-Info.plist已添加到我的项目中。但我不明白谷歌的意思是说:“将GoogleService-Info.plist添加到每个目标!!!”
I try add a GoogleInterchangeUtilities framework to "Link Binary With Libraries" and "Copy Frameworks" but it did not help!
我尝试添加一个GoogleInterchangeUtilities框架到“Link Binary With Libraries”和“Copy Frameworks”,但它没有帮助!
Help me please!
请帮帮我!
1 个解决方案
#1
1
I ran into a similar problem a couple of days ago. You should follow these steps.
几天前我遇到了类似的问题。您应该按照这些步骤操作。
- Install Cocoapods
- In Terminal, navigate to the directory which has your Xcode Project in it.
- Type
pod init
- Then type
pod install
(I know this sounds early but I will explain) - Open the workspace file and find the podfile that was created by Cocoapods. Edit that file to include
pod 'Google/Analytics'
- Go back to terminal and type
pod install
again. I could get not get Cocoapods to work with the podfile I created, so had to use the one they created. - Now, upon install, you should see that items have been downloaded.
- Go back into the workspace file, and set up your
-Bridging-Header.h
- Type this into the
-Bridging-Header.h
#import "Google/Analytics.h"
- If for some reason that doesn't work (it didn't for me), the type each individual item.
- Be sure to add the correct directory for your -Bridging-Header.h. You can find this under Project - Build Settings - Swift Compiler Code Generation. Use this to easily target your header file $(SWIFT_MODULE_NAME)-Bridging-Header.h
- Drag the
.plist
file into Xcode and select all of the targets, as seen in the below picture.
在终端中,导航到包含Xcode项目的目录。
输入pod init
然后键入pod install(我知道这听起来很早,但我会解释)
打开工作区文件,找到Cocoapods创建的podfile。修改该文件以包含广告管理系统'Google / Analytics'
返回终端并再次键入pod install。我可能无法让Cocoapods使用我创建的podfile,因此不得不使用他们创建的那个。
现在,安装后,您应该看到已下载的项目。
返回工作区文件,并设置-Bridging-Header.h
在-Bridging-Header.h #import“Google / Analytics.h”中输入
如果由于某种原因不起作用(它不适合我),每个单独项目的类型。
请务必为-Bridging-Header.h添加正确的目录。您可以在Project - Build Settings - Swift Compiler Code Generation下找到它。使用它可以轻松定位头文件$(SWIFT_MODULE_NAME)-Bridging-Header.h
将.plist文件拖到Xcode中并选择所有目标,如下图所示。
You will know that everything has installed correctly when you look into the Navigator in Xcode and see a PODS folder with a bunch of Google stuff in it. It should look like this in the navigator.
当您在Xcode中查看导航器并查看包含大量Google内容的PODS文件夹时,您将知道所有内容都已正确安装。它应该在导航器中看起来像这样。
That should have you squared away. I ran into many issues very similar to yours. Let me know if you need clarification on something.
这应该让你摆平。我遇到了许多与你非常相似的问题。如果您需要澄清某些内容,请与我们联系。
#1
1
I ran into a similar problem a couple of days ago. You should follow these steps.
几天前我遇到了类似的问题。您应该按照这些步骤操作。
- Install Cocoapods
- In Terminal, navigate to the directory which has your Xcode Project in it.
- Type
pod init
- Then type
pod install
(I know this sounds early but I will explain) - Open the workspace file and find the podfile that was created by Cocoapods. Edit that file to include
pod 'Google/Analytics'
- Go back to terminal and type
pod install
again. I could get not get Cocoapods to work with the podfile I created, so had to use the one they created. - Now, upon install, you should see that items have been downloaded.
- Go back into the workspace file, and set up your
-Bridging-Header.h
- Type this into the
-Bridging-Header.h
#import "Google/Analytics.h"
- If for some reason that doesn't work (it didn't for me), the type each individual item.
- Be sure to add the correct directory for your -Bridging-Header.h. You can find this under Project - Build Settings - Swift Compiler Code Generation. Use this to easily target your header file $(SWIFT_MODULE_NAME)-Bridging-Header.h
- Drag the
.plist
file into Xcode and select all of the targets, as seen in the below picture.
在终端中,导航到包含Xcode项目的目录。
输入pod init
然后键入pod install(我知道这听起来很早,但我会解释)
打开工作区文件,找到Cocoapods创建的podfile。修改该文件以包含广告管理系统'Google / Analytics'
返回终端并再次键入pod install。我可能无法让Cocoapods使用我创建的podfile,因此不得不使用他们创建的那个。
现在,安装后,您应该看到已下载的项目。
返回工作区文件,并设置-Bridging-Header.h
在-Bridging-Header.h #import“Google / Analytics.h”中输入
如果由于某种原因不起作用(它不适合我),每个单独项目的类型。
请务必为-Bridging-Header.h添加正确的目录。您可以在Project - Build Settings - Swift Compiler Code Generation下找到它。使用它可以轻松定位头文件$(SWIFT_MODULE_NAME)-Bridging-Header.h
将.plist文件拖到Xcode中并选择所有目标,如下图所示。
You will know that everything has installed correctly when you look into the Navigator in Xcode and see a PODS folder with a bunch of Google stuff in it. It should look like this in the navigator.
当您在Xcode中查看导航器并查看包含大量Google内容的PODS文件夹时,您将知道所有内容都已正确安装。它应该在导航器中看起来像这样。
That should have you squared away. I ran into many issues very similar to yours. Let me know if you need clarification on something.
这应该让你摆平。我遇到了许多与你非常相似的问题。如果您需要澄清某些内容,请与我们联系。