gpt4 book ai didi

ios - SpriteKit——SKTexture PreloadTextures EXC_BAD_ACCESS 崩溃

转载 作者:行者123 更新时间:2023-11-28 19:54:15 25 4
gpt4 key购买 nike

我正在尝试预加载纹理。当我预加载一个完整的 SKTextureAtlas 时,我的代码工作正常。但是,当我尝试预加载 SKTextures 时,出现 EXC_BAD_ACCESS 错误。这是我的代码:

[SKTexture preloadTextures:@[@"steady_beat-animation-shark_4"] withCompletionHandler:blah, blah];

无论我输入什么纹理、输入多少或调用此代码的位置(在 SKSceneSKSpriteNode 中),我都会收到 EXC_BAD_ACCESS 错误。

错误是:

objc_msgSend
Thread 4: EXC_BAD_ACCESS (code=1, address=0x1f)

如果有帮助,这里是调用堆栈符号:

(lldb) po [NSThread callStackSymbols]
<_NSCallStackArray 0x16f738f0>(
0 ??? 0x038a8b74 0x0 + 59411316,
1 Edify-Testing-Debug 0x000c9d89 main + 0,
2 libdispatch.dylib 0x0068cad3 _dispatch_call_block_and_release + 10,
3 libdispatch.dylib 0x006967c5 _dispatch_root_queue_drain + 968,
4 libdispatch.dylib 0x00697885 _dispatch_worker_thread3 + 108,
5 libsystem_pthread.dylib 0x32301e25 _pthread_wqthread + 668,
6 libsystem_pthread.dylib 0x32301b78 start_wqthread + 8
)

最佳答案

SKTexture preloadTextures: 采用 SKTexturesNSArray,而不是 NSString

https://developer.apple.com/library/ios/documentation/SpriteKit/Reference/SKTexture_Ref/index.html#//apple_ref/occ/clm/SKTexture/preloadTextures:withCompletionHandler :

[SKTexture preloadTextures:@[[SKTexture textureWithImageNamed:@"steady_beat-animation-shark_4"]] withCompletionHandler:blah, blah];

关于ios - SpriteKit——SKTexture PreloadTextures EXC_BAD_ACCESS 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27386257/

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