Buyin Brian
Buyin Brian

Reputation: 2991

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]);

Upvotes: 2

Views: 118

Answers (1)

user467105
user467105

Reputation:

You forgot the @ in front of the NSLog string:

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

Upvotes: 11

Related Questions