2017-05-03 71 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 
相關問題