views:

29

answers:

1

Hi, everyone,

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++)
{
    title = [csvPersonalTitleArray objectAtIndex:i];
    [dataTitleArray addObject:title];  // the dataTitleArray is null
}
+1  A: 

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

quixoto
@quixoto, thank you for your reply. I edited the post. I just want to add an array to another array.
Questions
`[oneArray addObjectsFromArray:anotherArray]`
quixoto