IM使用ASIHTTPRequest來調用Web服務(SOAP):ASIHTTPRequest代表團
-(void)callWebService:(NSString*)URL:(NSString*)SOAP{
NSURL *url = [NSURL URLWithString:URL];
NSString *SOAPMessage = [NSString stringWithFormat:SOAP];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
request.shouldAttemptPersistentConnection = NO;
[request setValidatesSecureCertificate:NO];
[request setRequestMethod:@"POST"];
[request appendPostData:[SOAPMessage dataUsingEncoding:NSUTF8StringEncoding]];
[request setDidFinishSelector:@selector(requestCompleted:)];
[request setDidFailSelector:@selector(requestFailed:)];
[request setDelegate:self];
[request startAsynchronous];
}
-(void)requestCompleted:(ASIHTTPRequest *)r{
NSString *responseString = [r responseString];
NSLog(@"%@",responseString);
}
-(void)requestFailed:(ASIHTTPRequest *)r{
NSError *Err = [r error];
NSLog(@"%@",Err);
}
如果我稱這種現象appDelegate.m,它工作正常,requestCompleted處理器拋出的響應......但是當我使用相同的代碼在我自己的類,它拋出錯誤訪問錯誤,我想通告訴我,我不能委派:自處理響應。如果我setDelegate到appdelgate指針(如ID發送者通過)它的工作原理(和具有的處理程序那裏)。那麼爲什麼我自己的班級不能處理自己的事件呢?我新的Objective-C,所以我想我在這裏失去了一些重要的東西。由於
可以在那裏你找到BAD訪問,請您發表您的類的.h文件中。 – applefreak