NSURL *jsonURL = [NSURL URLWithString:@"http://ambiguous.dubbelzinnig.com/index.php? get_cat=1"];
NSString *jsonData = [[NSString alloc] initWithContentsOfURL:jsonURL];
if (jsonData == nil) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Webservice Down" message:@"The webservice you are accessing is down. Please try again later." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
else {...
似乎需要更改 initWithContentsOfURL ,但我已经尝试了开发人员指南中所说的内容,但我无法让它工作......有人可以修复这个代码吗?
非常感谢!