diff --git a/Mixpanel/MPUIImageToNSDictionaryValueTransformer.m b/Mixpanel/MPUIImageToNSDictionaryValueTransformer.m index ad616c9b5..1096aa732 100644 --- a/Mixpanel/MPUIImageToNSDictionaryValueTransformer.m +++ b/Mixpanel/MPUIImageToNSDictionaryValueTransformer.m @@ -89,7 +89,9 @@ - (id)reverseTransformedValue:(id)value if (!error) { image = [UIImage imageWithData:imageData scale:fminf(1.0, scale.floatValue)]; @synchronized(imageCache) { - imageCache[imageDictionary[@"url"]] = image; + if (image) { + imageCache[imageDictionary[@"url"]] = image; + } } } } diff --git a/Mixpanel/Mixpanel.m b/Mixpanel/Mixpanel.m index 39d35ede5..3d02bab3a 100755 --- a/Mixpanel/Mixpanel.m +++ b/Mixpanel/Mixpanel.m @@ -267,7 +267,9 @@ - (void)track:(NSString *)event properties:(NSDictionary *)properties if (self.nameTag) { p[@"mp_name_tag"] = self.nameTag; } - p[@"distinct_id"] = self.distinctId; + if (self.distinctId) { + p[@"distinct_id"] = self.distinctId; + } [p addEntriesFromDictionary:self.superProperties]; if (properties) { [p addEntriesFromDictionary:properties]; diff --git a/Mixpanel/MixpanelPeople.m b/Mixpanel/MixpanelPeople.m index 6e9eb621b..63392c283 100644 --- a/Mixpanel/MixpanelPeople.m +++ b/Mixpanel/MixpanelPeople.m @@ -36,11 +36,21 @@ - (NSDictionary *)collectAutomaticPeopleProperties @"$ios_lib_version": [Mixpanel libVersion], }]; NSDictionary *infoDictionary = [NSBundle mainBundle].infoDictionary; - p[@"$ios_app_version"] = infoDictionary[@"CFBundleVersion"]; - p[@"$ios_app_release"] = infoDictionary[@"CFBundleShortVersionString"]; + if (infoDictionary[@"CFBundleVersion"]) { + p[@"$ios_app_version"] = infoDictionary[@"CFBundleVersion"]; + } + if (infoDictionary[@"CFBundleShortVersionString"]) { + p[@"$ios_app_release"] = infoDictionary[@"CFBundleShortVersionString"]; + } __strong Mixpanel *strongMixpanel = self.mixpanel; - [p setValue:[strongMixpanel deviceModel] forKey:@"$ios_device_model"]; - [p setValue:[strongMixpanel IFA] forKey:@"$ios_ifa"]; + NSString *deviceModel = [strongMixpanel deviceModel]; + if (deviceModel) { + p[@"$ios_device_model"] = deviceModel; + } + NSString *ifa = [strongMixpanel IFA]; + if (ifa) { + p[@"$ios_ifa"] = ifa; + } return [p copy]; }