gpt4 book ai didi

iphone - NSMutableArray 问题

转载 作者:行者123 更新时间:2023-12-03 20:20:20 26 4
gpt4 key购买 nike

谁能解释一下为什么这段代码会破坏我的应用程序:

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com