我的 .m 文件中有以下代码:
- (IBAction)LoginButton:(id)sender {
// create string contains url address for php file, the file name is phpFile.php, it receives parameter :name
NSString *strURL = [NSString stringWithFormat:@"http://www.myURL.com/verify.php?Email=%@",Email.text];
// to execute php code
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
// to receive the returend value
NSString *strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]autorelease];
NSLog(@"%@", strResult);
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Result:"
message:strResult
delegate:nil
cancelButtonTitle:@"Okay"
otherButtonTitles:nil];
[alert show];
}
而且我知道自动释放在自动引用计数模式下不可用。
以下行似乎是一个问题:
NSString *strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]autorelease];
我该如何解决这个问题?