diff --git a/include/mbgl/ios/MGLMapboxEvents.h b/include/mbgl/ios/MGLMapboxEvents.h
index 7a4c45fe1..c6cd13308 100644
--- a/include/mbgl/ios/MGLMapboxEvents.h
+++ b/include/mbgl/ios/MGLMapboxEvents.h
@@ -32,6 +32,7 @@ extern NSString *const MGLEventGestureRotateStart;
+ (void) setToken:(NSString *)token;
+ (void) setAppName:(NSString *)appName;
+ (void) setAppVersion:(NSString *)appVersion;
++ (void) setAppBuildNumber:(NSString *)appBuildNumber;
+ (void) pauseMetricsCollection;
+ (void) resumeMetricsCollection;
diff --git a/ios/app/app-info.plist b/ios/app/app-info.plist
index cd74f5839..fd03e7324 100644
--- a/ios/app/app-info.plist
+++ b/ios/app/app-info.plist
@@ -21,7 +21,7 @@
CFBundleSignature
MBGL
CFBundleVersion
- 0.0.2
+ 0.0.3
LSRequiresIPhoneOS
NSHumanReadableCopyright
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index f9ed77041..b61679a7d 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -223,8 +223,10 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
// metrics: initial setup
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+ NSString *appBuildNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
if (appName != nil) [MGLMapboxEvents setAppName:appName];
if (appVersion != nil) [MGLMapboxEvents setAppVersion:appVersion];
+ if (appBuildNumber != nil) [MGLMapboxEvents setAppBuildNumber:appBuildNumber];
// create GL view
//
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index b32e13988..b714c927d 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -62,6 +62,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
@property (atomic) NSString *token;
@property (atomic) NSString *appName;
@property (atomic) NSString *appVersion;
+@property (atomic) NSString *appBuildNumber;
@property (atomic) NSString *instanceID;
@property (atomic) NSString *advertiserId;
@property (atomic) NSString *vendorId;
@@ -247,6 +248,13 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
[MGLMapboxEvents sharedManager].appVersion = appVersion;
}
+// Must be called from the main thread.
+//
++ (void) setAppBuildNumber:(NSString *)appBuildNumber {
+ assert([[NSThread currentThread] isMainThread]);
+ [MGLMapboxEvents sharedManager].appBuildNumber = appBuildNumber;
+}
+
// Must be called from the main thread.
//
+ (void) pauseMetricsCollection {
@@ -455,8 +463,8 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
// Can be called from any thread.
//
- (NSString *) getUserAgent {
- if (self.appName != nil && self.appVersion != nil && ([self.userAgent rangeOfString:self.appName].location == NSNotFound)) {
- self.userAgent = [NSString stringWithFormat:@"%@/%@ %@", self.appName, self.appVersion, self.userAgent];
+ if (self.appName != nil && self.appVersion != nil && self.appBuildNumber != nil && ([self.userAgent rangeOfString:self.appName].location == NSNotFound)) {
+ self.userAgent = [NSString stringWithFormat:@"%@/%@-%@ %@", self.appName, self.appVersion, self.appBuildNumber, self.userAgent];
}
return self.userAgent;
}