两部分问题
第一部分: 我正在尝试为我的数据库创建一个ASynchronous请求.我目前正在同步这样做,但我想学习两种方法来更好地理解最新情况.
目前我已经设置了这样的同步调用.
- (IBAction)setRequestString:(NSString *)string
{
//Set database address
NSMutableString *databaseURL = [[NSMutableString alloc] initWithString:@"http://127.0.0.1:8778/instacodeData/"]; // imac development
//PHP file name is being set from the parent view
[databaseURL appendString:string];
//call ASIHTTP delegates (Used to connect to database)
NSURL *url = [NSURL URLWithString:databaseURL];
//SynchronousRequest to grab the data
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSError *error;
NSURLResponse *response;
NSData *result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if (!result) {
//Display error message here
NSLog(@"Error");
} else {
//TODO: set up …Run Code Online (Sandbox Code Playgroud) 我正在使用NSURLConnection和NSURLRequest类从iOS(iPad/iPhone)向我的python google应用引擎服务器发送http请求.
如何读取响应的状态,即app引擎使用的值response.set_status(200, message="Success")?
NSURLConnection's connectionDidFinishLoading在客户端收到委托电话后,我无法找到可以读取这些状态代码的位置.