Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You'll probably want to use the nsurlconnection class as follows (you'll just need to set the requestWithUrl parameter in the NSURLRequest which the web-service specific url):</p> <pre><code>-(void)getLocationsFromWebService { NSLog(@"in getLocationsFromWebService"); [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:TRUE]; NSURLRequest *theRequest = [NSURLRequest requestWithURL:self.locationsURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:100.0]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; self.requestType = @"GET"; if (theConnection) { _responseData = [[NSMutableData data] retain ]; } else { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE]; } } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE]; NSLog(@"in mapviewcontroller"); NSLog(@"Error connecting - %@",[error localizedDescription]); [connection release]; [_responseData release]; } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSHTTPURLResponse *HTTPResponse = (NSHTTPURLResponse *)response; NSInteger statusCode = [HTTPResponse statusCode]; if (404 == statusCode || 500 == statusCode) { //[self.controller setTitle:@"Error Getting Parking Spot ....."]; [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE]; [connection cancel]; NSLog(@"Server Error - %@", [NSHTTPURLResponse localizedStringForStatusCode:statusCode]); } else { if ([self.requestType isEqualToString:@"GET"]) [_responseData setLength:0]; } } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { if ([self.requestType isEqualToString:@"GET"]) [_responseData appendData:data]; } -(void) connectionDidFinishLoading:(NSURLConnection *)connection { if ([self.requestType isEqualToString:@"GET"]) { [self parseLocations:_responseData]; [_responseData release]; } [connection release]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload