我得到下面的代码来调用 PHP 脚本,由于某种原因它说连接成功,但实际上没有调用我的脚本,因为我没有收到电子邮件:-(
没有调用任何 NSURLConnectionDelegate 方法。
在 iPhone 5.x 设备和模拟器上进行测试。
有什么建议/想法吗?非常感谢你!
NSString* url = [NSString stringWithFormat:@"http://www.lenniedevilliers.net/mail.php?subject=%@&to=%@&body=%@", subjectLine, toAddress, emailBody ];
NSLog(@"web service URL: %@", url);
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString: url] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
connection = [[NSURLConnection alloc] initWithRequest: request delegate:self];
NSLog(@"connection: %@", [connection debugDescription]);
if (connection) {
NSLog(@"Connection succeeded");
} else {
NSLog(@"Connection failed");
}