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];
該代碼的最後一行顯示我錯誤,並建議「更改解析器暫停」!請幫忙!![解析器setDelegate:self];
您單擊您找到的答案旁邊的複選標記以回答您的問題。 – 2012-02-07 10:22:29