在没有 cocoa pods 的情况下无法将 Google Analytics iOS SDK 添加到我的项目

Can't add Google Analytics iOS SDK without cocoa pods to my project

我想将 Google Analytics iOS SDK 添加到我的项目中,但不幸的是它不起作用。我没有使用 Cocoa Pods,也许这就是问题所在,因为 Google 说在教程中使用它,但由于其他原因我不能在这个项目中使用它。

这就是我尝试的方式:

然后我将其添加到我的 AppDelegate.m

 #import <Google/Analytics.h>
 //...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Configure tracker from GoogleService-Info.plist.
    NSError *configureError;
    [[GGLContext sharedInstance] configureWithError:&configureError];
    NSAssert(!configureError, @"Error configuring Google services: %@", configureError);

   return YES;
}

它完全来自教程,但是当我尝试 运行 它时,我得到一个错误 Google/Analytics.h file not found。如果有人能告诉我问题出在哪里,或者有人能解释我如何在没有 cocoa pods 的情况下设置整个过程,我将不胜感激(我应该从 zip 添加哪些文件。)

我刚才也在寻找完全相同的东西。 I found this very simple tutorial,对我有用。如果您需要更多帮助,请告诉我。

#import <Google/Analytics.h> 仅在您使用 Cocoa Pods...

时有效

尝试:

#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIFields.h"
#import "GAILogger.h"

看看 link @AntonyG 给的!它将逐步指导您如何在没有 Cocoa Pods!

的情况下使用 Google Analytics

正在关注 the tutorial posted by won't do the trick unless you also add the following to your application target's linked libraries, as required by Google here

  • CoreData.framework
  • SystemConfiguration.framework
  • libz.dylib
  • libsqlite3.dylib