我想用一组对象构造一个字符串
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];
}
}
我想知道我做错了什么。提前致谢!!