简体   繁体   English

flurry分析如何跟踪我的应用版本号?

[英]How does flurry analytics track my apps version number?

I'm viewing my top used version numbers in flurry for my app. 我正在为我的应用程序查看我最常用的版本号。 It appears flurry is using the build number field (bundle version) in my plist to report what version a particular app is. 看来flurry正在我的plist中使用内部版本号字段(包版本)来报告特定应用程序的版本。 Is this true? 这是真的? If so, can I have use a different field in my plist? 如果是这样,我可以在我的plist中使用不同的字段吗? (ie Bundle Version string short) How? (即Bundle Version string short)怎么样? I frequently change the build number and I want to see something like 1.0.1 (a version) instead of 28 (a build number) in flurry. 我经常更改内部版本号,我希望看到像1.0.1(一个版本)而不是28(一个内部版本号)的东西。

I got bit by this too, it seems bizarre to me they would use the build number by default. 我对此也有所了解,对我来说似乎很奇怪他们会默认使用内部版本号。 I added an auto-incrementing build number script and by the time I next checked Flurry, it showed about 100 different "versions", each just a new build. 我添加了一个自动递增的内部版本号脚本,当我下次检查Flurry时,它显示了大约100个不同的“版本”,每个只是一个新版本。 Ugh, what a mess. 呃,真是一团糟。

The good news is the Flurry API provides a way to explicitly set the reported app version at runtime. 好消息是Flurry API提供了一种在运行时显式设置报告的应用版本的方法。 I have a #define in my prefix file that links to the "short version string", which in Apple's system is basically your user-facing app version (eg "1.0.2"), and is probably the one you want to be tracked in Flurry. 我的前缀文件中有#define链接到“短版本字符串”,在Apple的系统中基本上是面向用户的应用程序版本(例如“1.0.2”),可能是您想要跟踪的那个在乱舞。

#define kAppVersion [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]

Doing it this way means that you don't have to remember to set the version in more than one place. 这样做意味着您不必记住在多个位置设置版本。 Set it in your target's "Identity" section or in the Info.plist file and you're done. 将其设置在目标的“身份”部分或Info.plist文件中,您就完成了。

Then in my app delegate's application:didFinishLaunchingWithOptions: method, when I start up Flurry collections, I tell it to use that. 然后在我的app delegate的应用程序:didFinishLaunchingWithOptions:方法,当我启动Flurry集合时,我告诉它使用它。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [Flurry setCrashReportingEnabled:YES];
    [Flurry setAppVersion:kAppVersion]; // <-- will now report your short version string
    [Flurry startSession:kFlurryAPIKey];
    // ...
}

Above method is deprecated instead user as below. 不推荐使用上述方法,而不是以下用户。

    if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
        Flurry.startSession("xxxxxxxxxxxxxxxxxxx", with: FlurrySessionBuilder
            .init()
            .withCrashReporting(true)
            .withLogLevel(FlurryLogLevelAll).withAppVersion(version))
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM