NSString* username = [[NSUserDefaults standardUserDefaults] stringForKey:@"username_preference"];
NSString* accountPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"password_preference"];
NSString* urlString = [NSString stringWithFormat:@"https://%@:%@@testing.com/test.php",username,accountPassword];
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
int status = [httpResponse statusCode];
if (!((status >= 200) && (status < 300))) {
NSLog(@"Connection failed with status %@", status);
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
} else {
NSXMLParser* xmlparser = [[NSXMLParser alloc] initWithData: response];
NSLog(@"at parser %@", xmlparser);
[parser setDelegate:self];
代码的最后一行显示错误并建议“更改解析器暂停”!!请帮忙!!
答案 0 :(得分:2)
嗯,是不是因为你的解析器变量名为'xmlparser'而不是'parser'?
答案 1 :(得分:1)
将parser
更改为xmlparser
。