Created
November 24, 2009 00:48
-
-
Save ejknapp/241524 to your computer and use it in GitHub Desktop.
Start async call to Flak server
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)getNextMessages:(NSNumber *)maxMessageId { | |
if (!self.flakManager.isLoggedIn) { | |
[self createSession]; | |
} | |
// NSLog(@"In getNextMessages: %@", maxMessageId); | |
NSString *urlString = [NSString | |
stringWithFormat:@"%@/messages.json?kind=message&after_id=%@", | |
self.flakManager.hostURL, | |
maxMessageId]; | |
// NSLog(@"urlString: %@", urlString); | |
NSURL *url = [NSURL URLWithString:urlString]; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
NSURLConnection *connection = [[NSURLConnection alloc] | |
initWithRequest:request delegate:self]; | |
[connection release]; | |
// NSData *response = [NSURLConnection | |
// sendSynchronousRequest:request | |
// returningResponse:nil error:&error]; | |
// NSLog(@"messages error: %@", error); | |
// NSArray *messageArray = [[CJSONDeserializer deserializer] | |
// deserialize:response error:&error]; | |
// NSLog(@"messages error: %@", error); | |
// NSLog(@"about to get count of messageArray"); | |
// NSLog(@"messageArray length: %d", [messageArray count]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment