【发布时间】:2009-03-17 04:36:38
【问题描述】:
我试图遍历一个 NSArray 并在我尝试将位置 i 处的数组内容连接到我的 NSMutableString 实例时不断收到编译器错误。
它只是告诉我有一个“之前的语法错误;”这并没有告诉我很多。 在这一行:
[output appendString:[widget.children objectAtIndex:i];
我知道我的语法一定有问题..
我的功能如下
- (NSString *)readArray
{
NSMutableString *output = [[NSMutableString alloc] init];
int i;
int arraySize = widget.children.count;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
for (i = 0; i < arraySize; i++)
{
[output appendString:[widget.children objectAtIndex:i]; (throws error here)
}
[pool release];
return output;
}
提前致谢
【问题讨论】:
标签: objective-c iphone string-concatenation