receiving signal: EXC_BAD_ACCESS in web service call function
Posted
by
murali
on Stack Overflow
See other posts from Stack Overflow
or by murali
Published on 2012-07-07T09:47:20Z
Indexed on
2012/07/08
15:16 UTC
Read the original article
Hit count: 164
I'm new to iPhone development. I'm using xcode 4.2.
When I click on the save button, I'm getting values from the html page and my web service is processing them, and then I get the error:
program received signal: EXC_BAD_ACCESS
in my web service call function. Here is my code:
NSString *val=[WebviewObj stringByEvaluatingJavaScriptFromString:@"save()"];
NSLog(@"return value:: %@",val);
[adict setObject:[NSString stringWithFormat:@"%i",userid5] forKey:@"iUser_Id" ];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:0] forKey:@"vImage_Url"];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:1] forKey:@"IGenre_Id"];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:2] forKey:@"vTrack_Name"];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:3] forKey:@"vAlbum_Name"];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:4] forKey:@"vMusic_Url"];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:5] forKey:@"iTrack_Duration_min"];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:6] forKey:@"iTrack_Duration_sec"];
[adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:7] forKey:@"vDescription"];
NSLog(@"dict==%@",[adict description]);
NSString *URL2= @"http://184.164.156.55/Music/Track.asmx/AddTrack";
obj=[[UrlController alloc]init];
obj.URL=URL2;
obj.InputParameters = adict;
[obj WebserviceCall];
obj.delegate= self;
//this is my function..it is working for so many function calls
-(void)WebserviceCall{
webData = [[NSMutableData alloc] init];
NSMutableURLRequest *urlRequest = [[ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: URL ] ];
NSString *httpBody = @"";
for(id key in InputParameters)
{
if([httpBody length] == 0){
httpBody=[httpBody stringByAppendingFormat:@"&%@=%@",key,[InputParameters valueForKey:key]];
}
else{
httpBody=[httpBody stringByAppendingFormat:@"&%@=%@",key,[InputParameters valueForKey:key]];
}
}
httpBody = [httpBody stringByAppendingFormat:httpBody];//Here i am getting EXC_BAD_ACCESS
[urlRequest setHTTPMethod: @"POST" ];
[urlRequest setHTTPBody:[httpBody dataUsingEncoding:NSUTF8StringEncoding]];
[urlRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
}
Can any one help me please?
thanks in advance
© Stack Overflow or respective owner