Created
May 26, 2011 21:29
-
-
Save MSch/994130 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
-(void)pingAnalytics:(NSString*)action { | |
NSMutableString* params = [NSMutableString stringWithFormat:@"uuid=%@",[self getUUID]]; | |
#ifdef BETA | |
[params appendString:@"&beta=1"]; | |
#endif | |
NSString* url = [NSString stringWithFormat: @"https://update.appscape.at/degrees/%@?%@", action, params]; | |
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; | |
[request setHTTPMethod:@"GET"]; | |
[[NSURLConnection connectionWithRequest:request delegate:self] retain]; | |
} | |
-(NSString*)getUUID { | |
NSString* result = @"unknown"; | |
io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); | |
CFStringRef uuid = IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); | |
IOObjectRelease(ioRegistryRoot); | |
if (uuid) { | |
result = [NSString stringWithString:(NSString *)uuid]; | |
CFRelease(uuid); | |
} | |
return result; | |
} | |
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { | |
[connection release]; | |
} | |
- (void)connectionDidFinishLoading:(NSURLConnection *)connection { | |
[connection release]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment