NSString , EXC_BAD_ACCESS and stringByAppendingString

Posted by amnon on Stack Overflow See other posts from Stack Overflow or by amnon
Published on 2010-05-25T22:53:47Z Indexed on 2010/05/25 23:11 UTC
Read the original article Hit count: 184

Filed under:
|
|

Hi, i wrote the following code :

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 .

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa