Skip to content

Instantly share code, notes, and snippets.

@ejknapp
Created November 24, 2009 00:48
Show Gist options
  • Save ejknapp/241524 to your computer and use it in GitHub Desktop.
Save ejknapp/241524 to your computer and use it in GitHub Desktop.
Start async call to Flak server
- (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