iOS App Store评论崩溃



嘿:)所以我一直在编写一个应用程序,我想在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崩溃。

EDIT作为对评论的回应,高度和宽度是这样确定的:

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

- (id) init: (SKScene *) s中。此外,我刚刚发现,整个时间我的应用程序已经运行的逻辑场景继承从NSObject,而不是SKScene…这可能有影响吗(当我测试它时,应用程序运行相同)

很可能在符号化报告中实际的代码行中有一些行是错误的。由于上面报告的行实际上是创建字典的,并且崩溃是由创建字典时的异常引起的,因此很可能发生崩溃。在那里。

所以有问题的行是:

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]可以为零?

文档并没有真正说明,但我认为如果无法找到具有给定名称的字体,则会发生这种情况。所以你应该检查字体是否真的是你提交给苹果的app bundle的一部分。然后检查fontName属性是否设置为正确的值,并且在设备上也有效。文档说:

字体的完全指定名称。此名称包含字体族名称和字体

的特定样式信息。

这个线程可以提供一个在这种情况下可能出错的想法:异常尝试从objects[0]中插入nil对象

最新更新