gpt4 book ai didi

ios CGPointMake 错误 - 致命异常 NSRangeException

转载 作者:行者123 更新时间:2023-11-29 03:28:01 26 4
gpt4 key购买 nike

我从 Crashlytics 收到此错误。

Fatal Exception NSRangeException * -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array

我查看了我的代码,此时发生的情况如下:

CGPoint targetOffset = CGPointMake(currentEpisodeCellNumber * 90, 0);

我认为如果CGPointMake(0,0),我会崩溃。但我不确定这是主要问题。我不知道如何解决这个问题。

我添加了我的代码

if (self.episodeNumber > 1) {
sceneNumber = [[[episodesArray objectAtIndex:1] objectForKey:@"scene"] intValue];
}
else {
sceneNumber = [[[episodesArray objectAtIndex:0] objectForKey:@"scene"] intValue];
}

currentEpisodeCellNumber = self.episodeNumber - sceneNumber;

CGPoint targetOffset = CGPointMake(currentEpisodeCellNumber * 90, 0);

此时我遇到错误, sceneNumber = [[[episodesArray objectAtIndex:0] objectForKey:@"scene"] intValue];

最佳答案

在我看来,您从 Crashlytics 获得的崩溃不是您的 CGPointMake 函数调用。

崩溃消息告诉您正在尝试在空数组中获取对象 0。这很清楚。您的 CGPointMake 调用不引用任何数组。您需要再次查看导致崩溃的源代码行。

关于ios CGPointMake 错误 - 致命异常 NSRangeException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20203137/

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