Created
June 6, 2012 15:12
-
-
Save gertig/2882520 to your computer and use it in GitHub Desktop.
Send some data to the server for logging purposes
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
#pragma mark - Logging User Session Info | |
- (void)logToServer:(NSString *)reason thisInfo:(NSDictionary *)data | |
{ | |
UIDevice *device = [UIDevice currentDevice]; | |
NSString *deviceName = [device model]; | |
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; | |
NSString *userId = [NSString stringWithFormat:@"%d", self.getMyUserId]; | |
NSString *liveEventId = [NSString stringWithFormat:@"%d", self.getEventId]; | |
NSString *urlString = [NSString stringWithFormat:kLoggingURL, self.player.authentication_token]; | |
NSURL *url = [NSURL URLWithString:urlString]; | |
__unsafe_unretained ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; | |
[request setPostValue:userId forKey:@"log[user_id]"]; | |
[request setPostValue:liveEventId forKey:@"log[live_event_id]"]; | |
[request setPostValue:deviceName forKey:@"log[device_model]"]; | |
[request setPostValue:reason forKey:@"log[reason]"]; | |
[request setPostValue:appVersion forKey:@"log[app_version]"]; | |
[request addRequestHeader:@"Accept" value:@"text/javascript"]; | |
[request startAsynchronous]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add kLoggingURL to Constants.h
define kLoggingURL @"http://mysite.com/logs?token=%@"