Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSMutableArray issue

Can anyone explain why this code is breaking my app:

NSMutableArray *myArray = [[NSMutableArray alloc] initWithObjects:@"recipeA", @"recipeA1", @"recipeA2", @"recipeA3",@"recipeA4",@"recipeA5",@"recipeA6",@"recipeA7",nil];

//these both break the app with invalid pointer type warnings
NSLog("What is 0: %@", [myArray objectAtIndex:0]);
NSLog("What is the count: %i", [myArray count]);
like image 745
Buyin Brian Avatar asked Sep 23 '26 02:09

Buyin Brian


1 Answers

You forgot the @ in front of the NSLog string:

NSLog(@"What is 0: %@", [myArray objectAtIndex:0]);
NSLog(@"What is the count: %i", [myArray count]);

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!