i écrit le code suivant:NSString, EXC_BAD_ACCESS et stringByAppendingString
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];
les lignes sont réponse JSON analysées par jsonlib cette chaîne est retournée à un viewcontroller qu'il charge dans une WebView, mais je continue à me EXC_BAD_ACCESS pour ce code à la fin de la méthode qui l'appelle, je n'ai même pas à le charger sur le webview juste en appelant cette méthode et ne pas utiliser le nsstring provoque l'erreur à la fin de la méthode d'appel ... toute aide sera apperciated merci .
- (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];
}
avec ou sans la libération, il n'a pas d'importance
Ensuite, vous devez publier la méthode d'appel. – Yuji