Hi, i wrote the following code :
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSDictionary *reportDic = [jsonparser objectWithString:json_string error:nil];
NSDictionary *reporttable = [reportDic objectForKey:@"reporttable"];
NSArray *rows = [reporttable objectForKey:@"rows"];
NSString *table = [[NSString alloc]initWithString:@"<table>"] ;
for (NSDictionary *row in rows)
{
table = [table stringByAppendingString:@"<tr>"];
NSArray *cells = [row objectForKey:@"cells"];
for (NSString *cell in cells){
table = [table stringByAppendingString:@"<td>"];
table = [table stringByAppendingString:cell];
table = [table stringByAppendingString:@"</td>"];
}
table = [table stringByAppendingString:@"</tr>"];
index++;
}
table = [table stringByAppendingString:@"</table>"];
return [table autorelease];
the rows are json response parsed by jsonlib this string is returned to a viewcontroller that loads it into a webview ,but i keep getting exc_bad_access for this code on completion of the method that calls it , i don't even have to load it to the webview just calling this method and not using the nsstring causes the error on completion of the calling method... any help will be apperciated thanks .
- (void)viewDidLoad {
[super viewDidLoad];
AMAppDelegate *appDelegate = (AMAppDelegate*)[[UIApplication sharedApplication] delegate];
NSString * data = [appDelegate fetchTable:name psw:psw];
[webView loadHTMLString:@"this is html" baseURL:nil];
[data release];
}
with or without the release , it doesn't matter