2017-05-03 72 views

回答

2

Analytics只在您的GoogleService-Info.plist中使用一个Google App ID。没有办法将流量发送到这两个项目。我建议为测试和发布版本提供2个独立的项目。不建议将测试数据与生产数据混淆在一起,因为混淆了生产数据,生产数据可能无法反映出测试数据在其中的真实行为。例如,如果您每天晚上通过安装和卸载运行“测试”应用程序,则您的生产应用程序中可能每天都有新用户。

有一两件事你可以做的是有一个GoogleService-Info.plist中的释放,但使用运行时API来使用自定义FIROptions

-[FIROptions initWithContentsOfFile:(NSString *)plistPath] 

其中plistPath是路径的自定义GoogleService-信息例如CustomGoogleService-Info.plist。或者

- (instancetype)initWithGoogleAppID:(NSString *)googleAppID 
          bundleID:(NSString *)bundleID 
         GCMSenderID:(NSString *)GCMSenderID 
          APIKey:(NSString *)APIKey 
          clientID:(NSString *)clientID 
         trackingID:(NSString *)trackingID 
        androidClientID:(NSString *)androidClientID 
         databaseURL:(NSString *)databaseURL 
         storageBucket:(NSString *)storageBucket 
        deepLinkURLScheme:(NSString *)deepLinkURLScheme; 

用这种方法,你可以把它放在编译器标志下面用于测试版本。在发行版中,编译器标志将删除该行并为发行版使用正确的GoogleService-Info.plist。 例如:

#ifdef TESTING  
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:pathToCustomPlist]; 
[FIRApp configureWithOptions:options]; 
#endif // TESTING 
相关问题