gpt4 book ai didi

objective-c - Objective-C - 错误 : Thread 1: EXC_BAD_ACCESS code=2

转载 作者:搜寻专家 更新时间:2023-10-30 19:52:01 28 4
gpt4 key购买 nike

我在尝试调用方法时遇到错误。

方法

- (void)setSpeed:(GLKVector2)newSpeed{  //Error message (see title) points to here
self.speed = GLKVector2Make(newSpeed.x, newSpeed.y);
}

电话

[self setSpeed:GLKVector2Make(0, 0)];

有什么想法吗?

最佳答案

尝试写

_speed = GLKVector2Make(newSpeed.x, newSpeed.y);

speed = GLKVector2Make(newSpeed.x, newSpeed.y);

代替

self.speed = GLKVector2Make(newSpeed.x, newSpeed.y);

关于objective-c - Objective-C - 错误 : Thread 1: EXC_BAD_ACCESS code=2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17626311/

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