开发者

Cannot addObject into a NSMutableArray?

开发者 https://www.devze.com 2023-01-13 02:02 出处:网络
I have a question about the objective-C. I use the following code to add a contains from an array to another array. However, the second array is null. Can anyone help me? Thank you.

I have a question about the objective-C. I use the following code to add a contains from an array to another array. However, the second array is null. Can anyone help me? Thank you.

titleArray = [[csvDataArrayString objectAtIndex:0] componentsSeparatedByString:@","];

NSString *title;

dataTitleArray = [[NSMutableArray alloc] init];  // after add this statement it's ok

for(int i=0; i<[tTitleArray count]; i++)
{
    tit开发者_C百科le = [csvPersonalTitleArray objectAtIndex:i];
    [dataTitleArray addObject:title];  // the dataTitleArray is null
}


You haven't shown that you're actually allocating dataTitleArray anywhere. Are you? It's not clear what you're trying to do.

0

精彩评论

暂无评论...
验证码 换一张
取 消