谁能解释一下为什么这段代码会破坏我的应用程序:
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]);
最佳答案
您忘记了 NSLog 字符串前面的@
:
NSLog(@"What is 0: %@", [myArray objectAtIndex:0]);
NSLog(@"What is the count: %i", [myArray count]);
关于iphone - NSMutableArray 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4995654/