iOS App Store评论崩溃

时间:2014-03-16 19:09:09

标签: ios ipad crash

嘿:)所以我一直在编写一个我希望在App Store上可用的应用程序。但是,我已经提交了两次关于在iPad上播放应用程序时崩溃的拒绝(对于两个提交都运行7.0.6和7.1)。该应用程序可以在我的手机和我母亲的iPad上以及所有模拟器上完美运行。我还查看了崩溃日志(此处发布的相关信息):

Date/Time:           2014-03-15 14:29:04.504 -0700
OS Version:          iOS 7.1 (11D167)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x182fb6950 __exceptionPreprocess + 132
1   libobjc.A.dylib                 0x18f9901fc objc_exception_throw + 60
2   CoreFoundation                  0x182ec0c7c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 396
3   CoreFoundation                  0x182ec0ac4 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 72
4   Water Balloon                   0x1000b0be4 -[WBLogic updateScoreboard:] (WBLogic.m:406)
5   Water Balloon                   0x1000b0598 -[WBLogic checkCollision:] (WBLogic.m:341)
6   Water Balloon                   0x1000aff10 -[WBLogic update] (WBLogic.m:231)
7   SpriteKit                       0x185e47fb0 -[SKView(Private) _update:] + 236
8   SpriteKit                       0x185e45ab0 -[SKView renderCallback:] + 876
9   SpriteKit                       0x185e43794 __29-[SKView setUpRenderCallback]_block_invoke + 76
10  SpriteKit                       0x185e62a90 -[SKDisplayLink _callbackForNextFrame:] + 288
11  QuartzCore                      0x185bbccbc CA::Display::DisplayLinkItem::dispatch() + 36
12  QuartzCore                      0x185bbcac8 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 300
13  IOKit                           0x183eb7e74 IODispatchCalloutFromCFMessage + 364
14  CoreFoundation                  0x182f682e0 __CFMachPortPerform + 192
15  CoreFoundation                  0x182f76890 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
16  CoreFoundation                  0x182f767f0 __CFRunLoopDoSource1 + 444
17  CoreFoundation                  0x182f74a14 __CFRunLoopRun + 1620
18  CoreFoundation                  0x182eb56d0 CFRunLoopRunSpecific + 452
19  GraphicsServices                0x188b51c0c GSEventRunModal + 168
20  UIKit                           0x185fe6fdc UIApplicationMain + 1156
21  Water Balloon                   0x1000b1c38 main (main.m:16)
22  libdyld.dylib                   0x18ff83aa0 start + 4


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x000000019007e58c __pthread_kill + 8
1   libsystem_c.dylib               0x0000000190012804 abort + 108
2   libc++abi.dylib                 0x000000018f238990 abort_message + 84
3   libc++abi.dylib                 0x000000018f255c28 default_terminate_handler() + 296
4   libobjc.A.dylib                 0x000000018f9904d0 _objc_terminate() + 124
5   libc++abi.dylib                 0x000000018f253164 std::__terminate(void (*)()) + 12
6   libc++abi.dylib                 0x000000018f252a7c __cxa_throw + 132
7   libobjc.A.dylib                 0x000000018f990314 objc_exception_throw + 340
8   QuartzCore                      0x0000000185bbcd7c CA::Display::DisplayLinkItem::dispatch() + 228
9   QuartzCore                      0x0000000185bbcac4 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 296
10  IOKit                           0x0000000183eb7e70 IODispatchCalloutFromCFMessage + 360
11  CoreFoundation                  0x0000000182f682dc __CFMachPortPerform + 188
12  CoreFoundation                  0x0000000182f7688c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
13  CoreFoundation                  0x0000000182f767ec __CFRunLoopDoSource1 + 440
14  CoreFoundation                  0x0000000182f74a10 __CFRunLoopRun + 1616
15  CoreFoundation                  0x0000000182eb56cc CFRunLoopRunSpecific + 448
16  GraphicsServices                0x0000000188b51c08 GSEventRunModal + 164
17  UIKit                           0x0000000185fe6fd8 UIApplicationMain + 1152
18  Water Balloon                   0x00000001000b1c34 main (main.m:16)
19  libdyld.dylib                   0x000000018ff83a9c start + 0

通常情况下,崩溃日志可用于指出崩溃发生的位置,这会导致崩溃发生的原因,但406行只指向代码中的这一行:

scorelabel.position = CGPointMake(width/2, height/2 + 150);

这一行的整个方法是:

- (void) updateScoreboard:(BOOL) on
{
    if(on)
    {
        int w = scoreboard.size.width;
        int h = scoreboard.size.height;

        if(score > highScore)
        {
            highScore = score;
            [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:highScore] forKey:@"HighScore"];
        }
        [highScorelabel setText:[NSString stringWithFormat:@"High Score: %i", highScore]];

        CGSize defs;
        CGSize ss;
        CGSize hs;

        defs = [@"Score: 1" sizeWithAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"04b_19" size:scorelabel.fontSize]}];
        ss = [[scorelabel text] sizeWithAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"04b_19" size:scorelabel.fontSize]}];
        hs = [[highScorelabel text] sizeWithAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"04b_19" size:highScorelabel.fontSize]}];

        scorelabel.position = CGPointMake(width/2 - w/4 - defs.width/2 + ss.width/2, scoreboard.position.y + h/4);
        highScorelabel.position = CGPointMake((scorelabel.position.x - ss.width/2) + hs.width/2, scorelabel.position.y - ss.height/2 - hs.height/2);
    }
    else
    {
        scorelabel.position = CGPointMake(width/2, height/2 + 150);
    }
    [scoreboard setHidden:!on];
    [taplabel setHidden:!on];
    [highScorelabel setHidden:!on];
}

我不知道问题是什么......请帮我找出该应用导致他们的iPad崩溃的原因。

编辑在回复评论时,身高和宽度的确定如下:

width = scene.frame.size.width;
height = scene.frame.size.height;

哪个在- (id) init: (SKScene *) s。另外,我刚刚发现我的应用程序一直运行的时间是从NSObject继承的逻辑场景,而不是SKScene ...这可能会产生影响(当我测试时应用程序运行相同)。

1 个答案:

答案 0 :(得分:4)

符号化报告中的实际代码行可能会被某些行关闭。从上面报告的行开始,您实际上创建了字典,并且在创建字典时由于异常导致崩溃,很可能发生了崩溃。那里。

所以有问题的行是:

defs = [@"Score: 1" sizeWithAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"04b_19" size:scorelabel.fontSize]}];
ss = [[scorelabel text] sizeWithAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"04b_19" size:scorelabel.fontSize]}];
hs = [[highScorelabel text] sizeWithAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"04b_19" size:highScorelabel.fontSize]}];

字典总是一样的:

@{NSFontAttributeName:[UIFont fontWithName:@"04b_19" size:highScorelabel.fontSize]}

因此,作为第一步,您应该为该字典创建一个局部变量并重新使用它。

现在,在创建字典时会导致崩溃,因为我们必须在此处猜测崩溃报告中缺少异常消息。一种选择是您尝试将密钥设置为nil值。那么什么时候[UIFont fontWithName:@"04b_19" size:highScorelabel.fontSize]可以为零?

文档并没有真正说明,但我认为如果找不到具有给定名称的字体,就会发生这种情况。因此,您应该检查字体是否真的是您提交给Apple的应用程序包的一部分。然后检查fontName属性是否设置为也适用于设备的正确值。文档说:

  

字体的完全指定名称。此名称包含字体系列名称和字体的特定样式信息

这个帖子可以提供一个在这种情况下可能出错的想法:Crash with exception attempt to insert nil object from objects[0]