オブジェクトの配列で文字列を構築したい
for (int n=0; n<[friends count]; n++) {
User* friend = [friends objectAtIndex:n];
if (n>=[friends count]-1) {
NSString* param = [NSString stringWithFormat:@"{\"target_id\":\"dummy(%d)\"}", [friend uid]];
NSString* sf2 = [[NSString alloc]init];
sf2= [sf stringByAppendingString:param];
[sf release];
sf = [[NSString alloc]initWithString:sf2];
[sf2 release];
[param release];
}else{
NSString* param = [NSString stringWithFormat:@"{\"target_id\":\"dummy(%d)\"},", [friend uid]];
NSString* sf2 = [[NSString alloc]init];
sf2= [sf stringByAppendingString:param];
[sf release];
sf = [[NSString alloc]initWithString:sf2];
[sf2 release];
[param release];
}
}
私が間違っていることを知りたいです。前もって感謝します!!