gpt4 book ai didi

ios - NSArray.count 返回不正确的巨型整数

转载 作者:行者123 更新时间:2023-11-28 20:16:53 26 4
gpt4 key购买 nike

我有以下代码,旨在从数组中选择一个随机字符串。

NSArray *popupMessages = [NSArray arrayWithObjects:
@"Shoulda' been bobbin' and weaving! Need anything from the shop?",
@"Don't forget you can use old boss's guns! Available in the shop!",
@"Hey Chaz, you Bojo! You need more POWER! Come by the shop for some better weapons!",
@"Aw… lame. Maybe I got something that can help you out here at my shop!",

nil];
int pmCount = popupMessages.count; // Breakpoint Here - pmCount = 971056545

int messageIndex = arc4random() % pmCount; // Breakpoint Here - same as above

我正在将 ARC 与 cocos2d 一起使用。关于为什么数组的计数返回如此巨大的数字有什么想法吗?谢谢!

最佳答案

您的问题看起来像是一个调试器工件。例如,它可能与优化相关。有时,编译器生成的代码会严重混淆调试器。添加日志语句以确保调试器不只是在告诉您谎言。

关于ios - NSArray.count 返回不正确的巨型整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17757026/

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