น่าจะเหมือน Web Service หรือเปล่าครับ ผมยังศึกษาไม่ถึงครับ
/ Create the URL from a string.
NSURL *url = [NSURL URLWithString:@"http://www.yourwebserverurl.com/restmethod"];
// Create a request object using the URL.
NSURLRequest *request = [NSURLRequest requestWithURL:url];
// Prepare for the response back from the server
NSHTTPURLResponse *response = nil;
NSError *error = nil;
// Send a synchronous request to the server (i.e. sit and wait for the response)
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
// Check if an error occurred
if (error != nil) {
NSLog(@"%@", [error localizedDescription]);
// Do something to handle/advise user.
}
// Convert the response data to a string.
NSString *responseString = [NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
// View the data returned - should be ready for parsing.
NSLog(@"%@", responseString);