Cannot addObject into a NSMutableArray?
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.
精彩评论