gpt4 book ai didi

iphone - GameCenter 功能崩溃应用程序 - 谁能帮忙解决?

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

我有一个象征性的当前 iPhone 应用程序的崩溃日志,但我无法破译问题仍然存在。

基本问题是在某些设备(尤其是旧设备)上,我的应用程序崩溃回到主屏幕。似乎是当用户在一段时间后回到我的游戏时 - 这会启动游戏中心的登录过程。我在下面粘贴了崩溃日志的相关部分:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x2e000000
Crashed Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x37c11f7e objc_msgSend + 22
1 Transfer Quiz 0x000023c4 -[GameCenterManager callDelegate:withArg:error:] (GameCenterManager.m:113)
2 Transfer Quiz 0x0000230c __60-[GameCenterManager callDelegateOnMainThread:withArg:error:]_block_invoke_0 (GameCenterManager.m:103)
3 libdispatch.dylib 0x346fdc52 _dispatch_call_block_and_release + 6
4 libdispatch.dylib 0x346ffee0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 188
5 CoreFoundation 0x358432a6 __CFRunLoopRun + 1262
6 CoreFoundation 0x357c649e CFRunLoopRunSpecific + 294
7 CoreFoundation 0x357c6366 CFRunLoopRunInMode + 98
8 GraphicsServices 0x37462432 GSEventRunModal + 130
9 UIKit 0x332d2cce UIApplicationMain + 1074
10 Transfer Quiz 0x000030d4 main (main.m:16)
11 Transfer Quiz 0x000021a8 start + 32

以下是 GameCenterManager callDelegate 的代码:
- (void) callDelegate: (SEL) selector withArg: (id) arg error: (NSError*) err
{
assert([NSThread isMainThread]);
if([delegate respondsToSelector: selector])
{
if(arg != NULL)
{
[delegate performSelector: selector withObject: arg withObject: err];
}
else
{
[delegate performSelector: selector withObject: err];
}
}
else
{
NSLog(@"Missed Method");
}
}

该代码是外部教程网站上教程的一部分 - 我无法确定导致我的应用程序在此处崩溃的问题。

有谁知道代码导致崩溃的原因?任何帮助将非常感激。我发现很难在任何设备上复制崩溃,并且使用 NSZombies 也无法正常工作,可能是因为我无法重新创建崩溃。

谢谢大家。

最佳答案

您调用的选择器似乎需要 2 个参数:一个“arg”和一个“error”。现在的问题是,如果 'arg' 为 nil,您将选择器调用为 只有一个参数 - 所以第二个参数基本上是垃圾,当调用选择器的对象尝试访问第二个参数时,它会崩溃。总而言之,你不需要 if() - 始终将两个参数都传递给选择器,并让委托(delegate)检测其第一个参数是否为 nil。

关于iphone - GameCenter 功能崩溃应用程序 - 谁能帮忙解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12340582/

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