[iOS] Use CFBundleIdentifier instead of CFBundleName in UA string

Although often recommended, CFBundleName is not guaranteed to exist in
an app's configuration. As an identifier of telemetry data, even when
it is present it can be inconsistent because of localization.

CFBundleIdentifier, although possibly longer, will be consistent
across locales and for the lifetime of an app in the App Store even
if the app name changes in any locale.
This commit is contained in:
Jesse Bounds
2016-03-16 07:06:43 -07:00
parent a69df28d21
commit aa60d29534

View File

@@ -115,7 +115,7 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
}
- (void)setupUserAgent {
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *appBuildNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
NSString *semanticVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"];