Skip to content

Commit

Permalink
Merge pull request #534 from mixpanel/nullability-checks
Browse files Browse the repository at this point in the history
nullability checking to not cause throws
  • Loading branch information
Yarden Eitan authored Jun 24, 2016
2 parents 0026e1a + c50e443 commit 983b57d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Mixpanel/MPUIImageToNSDictionaryValueTransformer.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Mixpanel/Mixpanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
18 changes: 14 additions & 4 deletions Mixpanel/MixpanelPeople.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down

0 comments on commit 983b57d

Please sign in to comment.