Last active
March 17, 2022 04:50
-
-
Save adambard/e9823f94d3ff5de69ed9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TSTapstream *tracker = [TSTapstream instance]; | |
// Call getConversionData to get the user's timeline history | |
[tracker getConversionData:^(NSData *jsonInfo) { | |
if(jsonInfo == nil) | |
{ | |
// No conversion data available | |
} | |
else | |
{ | |
NSError *error; | |
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonInfo options:kNilOptions error:&error]; | |
if(!json || error) | |
{ | |
// No luck parsing the JSON | |
} | |
else | |
{ | |
NSArray* hits = [json objectForKey:@"hits"]; | |
if(!hits || [hits count] == 0) | |
{ | |
// No hits in timeline | |
} | |
else | |
{ | |
// Hit exists in timeline | |
NSDictionary* hit = [hits objectAtIndex:0]; // Grab the oldest hit | |
if(!hit) | |
{ | |
// Couldn't get any hits | |
} | |
else | |
{ | |
NSString* slug = [hit objectForKey:@"tracker"]; | |
//Do something with the slug... | |
} | |
} | |
} | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment