i am having a array called temparray and have 2 seperate arrays .i have two buttons ,when i tap the first button it lodes the first array to the temp array,and when i tap the second button it lods the second array to the temparray.
my code is
-(IBAction)_clickbtnlanselmlayalm:(id)sender
{
[tempArray removeAllObjects];
[tempArray addObjectsFromArray:delegate.allSelectedVerseMalayalam];
[self.tab reloadData];
}
-(IBAction)_clickbtnlanselhindi:(id)sender
{
[tempArray removeAllObjects];
[tempArray addObjectsFromArray:delegate.allSelectedVerseHindi];
[self.tab reloadData];
}
allSelectedVerseMalayalam and allSelectedVerseHindi are two arrays which lodes from application delegate.after tap the first button it losds the first array and show it in tableview,but when i tap the scrond button i receve a warning in [tempArray removeAllObjects]; programe receiving signal sigrabat.and it crashes the app.then i put [tempArray removeAllObjects]; again it crashes.
whats the problem in my code.please help me to find the eroor.
thanks in advance.
Are you sure your
tempArrayis properly initialized and is in fact aNSMutableArray(NSArrays are immutable and don’t supportaddObject:/removeAllObjects/etc)?