我新的目標C,所以我真的不甚至知道這消息意味着:接收EXC_BAD_ACCESS消息,下面的代碼
EXC_BAD_ACCESS
當執行以下代碼:
-(void)HelloWorld
{
NSURL *url = [NSURL URLWithString:@"http://example.com/service.asmx/HelloWorld"];
NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL: url];
//do post request for parameter passing
[request setHTTPMethod:@"POST"];
//set the content type to JSON
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[connection release];
[request release];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
// Store incoming data into a string
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}
我試圖與Json框架集成。
我打電話給HelloWorld,它會對我的服務執行一個異步請求。奇怪的是,它有一次工作,現在我每隔一段時間都會收到這條EXC_BAD_ACCESS消息。任何想法會造成這種情況?
命名約定:' - (void)helloWorld' – raidfive 2011-04-07 02:31:02
@raidfive謝謝,從.NET轉換;) – 2011-04-07 13:48:30