Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Following is kicked off with this call:
- [self stringWithUrl:[NSURL URLWithString:@"<URL HERE>"]];
- - (void)stringWithUrl:(NSURL *)url
- {
- NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url
- cachePolicy:NSURLRequestReturnCacheDataElseLoad
- timeoutInterval:30];
- [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
- }
- -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
- NSLog(@"did receive response");
- responseData = [[NSMutableData alloc] init];
- //jsonString = [[NSString alloc] init];
- }
- -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
- NSLog(@"did receive data");
- //[jsonString appendData:data];
- [responseData appendData:data];
- }
- -(void)connectionDidFinishLoading:(NSURLConnection *)connection {
- NSLog(@"Succeeded data! Received %d bytes of data",[responseData length]);
- jsonString = [[[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding] autorelease];
- SBJSON *jsonParser = [SBJSON new];
- //feed = [(NSDictionary *)feed initWithData:[jsonParser objectWithString:jsonString error:NULL]];
- id response = [jsonParser objectWithString:jsonString error:NULL];
- feed = (NSDictionary *)response;
- //[tableView reloadData];
- }
Add Comment
Please, Sign In to add comment