Skip to content

Commit

Permalink
Use union for sending iOS device ids
Browse files Browse the repository at this point in the history
  • Loading branch information
kasrak committed Aug 17, 2012
1 parent 4becb31 commit 414cab8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions MPLib/MixpanelAPI.m
Expand Up @@ -669,10 +669,12 @@ - (void)registerForPushWithDeviceToken:(NSData*)deviceToken {
const unsigned char *buffer = (const unsigned char *)[deviceToken bytes];
if (!buffer) return;
NSMutableString *hex = [NSMutableString stringWithCapacity:(deviceToken.length * 2)];
for (int i = 0; i < deviceToken.length; i++)
[hex appendString:[NSString stringWithFormat:@"%02x", (unsigned long)buffer[i]]];
for (NSUInteger i = 0; i < deviceToken.length; i++)
[hex appendString:[NSString stringWithFormat:@"%02lx", (unsigned long)buffer[i]]];

[self setUserProperty:[NSArray arrayWithObject:[NSString stringWithString:hex]] forKey:@"$ios_devices"];
[self addPersonToQueueWithAction:@"$union" andProperties:
[NSDictionary dictionaryWithObject:[NSArray arrayWithObject:[NSString stringWithString:hex]] forKey:@"$ios_devices"]
];
}

- (void)dealloc {
Expand Down

0 comments on commit 414cab8

Please sign in to comment.