iPhone開発初心者です。私はxcode 4.2を使用しています。
保存ボタンをクリックすると、HTML ページから値を取得し、Web サービスがそれらを処理していて、エラーが発生します。
プログラム受信シグナル: EXC_BAD_ACCESS
私のWebサービス呼び出し機能で。これが私のコードです:
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];
}
誰でも私を助けてもらえますか?
前もって感謝します