在iPad上更新了App Crashing [英] Updated App Crashing on iPad

查看:48
本文介绍了在iPad上更新了App Crashing的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很有趣.我有一个通用应用程序. iPhone和iPad版本都共享相同的类,只是具有不同的xib文件.我经常收到报告说,更新iPad版本后,它将无法运行,并且只会崩溃.但是,对iPhone版本进行更新就可以了.删除iPad应用程序,然后重新启动并重新安装将解决启动时崩溃的问题.

This is interesting. I have a Universal app. The iPhone and iPad versions both share the same Classes, and just have different xib files. I have been getting frequent reports that after updating the iPad version, it will not run, and simply crashes. However, updates to the iPhone version work just fine. Deleting the iPad app, restarting, and reinstalling will fix the crash at startup issue.

使用受影响的代码更新:

Update With Affected Code:

好的,所以在重新标记并查看受影响的代码行之后,这就是我认为引起问题的所有区域.

Ok, so after resymbolicating and viewing the affected line of codes, here is all the areas I feel are causing issues.

我想让应用程序第一次问一个问题,并且只在第一次运行该应用程序时问一个问题,所以在AppDelegate中,我有:

I wanted the app to ask a question the first time, and ONLY the first time the app was ran, so in the AppDelegate didFinishLaunchingWithOptions I have:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (! [defaults boolForKey:@"notFirstRun"]) {
    UIAlertView *firstrun = [[UIAlertView alloc] initWithTitle:@"Sermon Preference" message:@"Do you prefer audio only, or video sermons?  (This setting can be changed at any time in the Settings Page.)" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Audio", @"Video", nil];
        [firstrun show];
        [firstrun release];
    [defaults setBool:YES forKey:@"notFirstRun"];
}

然后我在AppDelegate静止图像中

Then I have in the AppDelegate Still:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
        if (buttonIndex == 0)       {   
            NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
            NSString *nope = @"Audio";
            [defaults setObject:nope forKey:@"videosermons"];
            [defaults synchronize];


        }
        if (buttonIndex == 1)        {
            NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
            NSString *yup = @"Video";
            [defaults setObject:yup forKey:@"videosermons"];
            [defaults synchronize];        }

        }

我希望在设置"窗口中更改这些值,所以在设置"类中,我有:

I wanted these values to be changed in a Settings window, so in the Settings class I have:

- (void)viewDidLoad
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];


        NSString *currently = [defaults objectForKey:@"videosermons"];

    if ([currently isEqualToString:@"Audio"]) {
        segment.selectedSegmentIndex = 0;
    }
    if ([currently isEqualToString:@"Video"]) {
        segment.selectedSegmentIndex = 1;
    }


    NSString *firstName = [defaults objectForKey:@"firstName"];
    if (firstName  == nil) {

    }
    else {
        myTextField.text = firstName;
    }
    NSURL *url = [NSURL URLWithString:@"http://www.bellavenue.org/worship.html"];
    self.content = [NSString stringWithContentsOfURL:url];
    [super viewDidLoad];
}

崩溃日志指出导致崩溃的行是:

The line that the crash log says is causing the crash is:

    if ([currently isEqualToString:@"Audio"]) {

正在发生的所有事情仅在iPad上导致崩溃,并且仅在更新已安装的先前版本而不是新安装时才导致崩溃?

What all is going on that is causing a crash ONLY on the iPad, and ONLY when updating an already installed previous version, and not a NEW install?

更新崩溃日志:

Incident Identifier: EE5B1A62-12DB-4ED5-95CD-0C68CE1614BA
CrashReporter Key:   92fbea1d35e30ff292ba7362f93548dceedefe66
Hardware Model:      iPad2,5
Process:         Bell Avenue [1013]
Path:            /var/mobile/Applications/CE1AE921-5767-4B3C-B223-2C098041C73E/Bell Avenue.app/Bell Avenue
Identifier:      Bell Avenue
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-12-01 14:11:10.653 -0600
OS Version:      iOS 6.1 (10B5105c)
Report Version:  104

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

Last Exception Backtrace:
0   CoreFoundation                  0x3411529e 0x34053000 + 795294
1   libobjc.A.dylib                 0x33f3297a 0x33f2a000 + 35194
2   CoreFoundation                  0x34118e02 0x34053000 + 810498
3   CoreFoundation                  0x3411752c 0x34053000 + 804140
4   CoreFoundation                  0x3406ef64 0x34053000 + 114532
5   Bell Avenue                     0x0008652e -[Settings viewDidLoad] (Settings.m:64)
6   UIKit                           0x3396578c 0x337c5000 + 1705868
7   UIKit                           0x3396d5fa 0x337c5000 + 1738234
8   UIKit                           0x3399786a 0x337c5000 + 1910890
9   UIKit                           0x33820ae4 0x337c5000 + 375524
10  UIKit                           0x337c8f7c 0x337c5000 + 16252
11  UIKit                           0x337c8a10 0x337c5000 + 14864
12  UIKit                           0x337c845e 0x337c5000 + 13406
13  GraphicsServices                0x3afaf59e 0x3afa9000 + 26014
14  GraphicsServices                0x3afaf1ce 0x3afa9000 + 25038
15  CoreFoundation                  0x340ea16e 0x34053000 + 618862
16  CoreFoundation                  0x340ea112 0x34053000 + 618770
17  CoreFoundation                  0x340e8f94 0x34053000 + 614292
18  CoreFoundation                  0x3405beb8 0x34053000 + 36536
19  CoreFoundation                  0x3405bd44 0x34053000 + 36164
20  UIKit                           0x3381f7c8 0x337c5000 + 370632
21  UIKit                           0x3381c644 0x337c5000 + 357956
22  Bell Avenue                     0x000832fe main (main.m:13)
23  libdyld.dylib                   0x39d7ab1c 0x39d79000 + 6940


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x385b6350 0x385a5000 + 70480
1   libsystem_c.dylib               0x3a64d11e 0x3a61e000 + 192798
2   libsystem_c.dylib               0x3a68996e 0x3a61e000 + 440686
3   libc++abi.dylib                 0x33e1cd4a 0x33e19000 + 15690
4   libc++abi.dylib                 0x33e19ff4 0x33e19000 + 4084
5   libobjc.A.dylib                 0x33f32a74 0x33f2a000 + 35444
6   libc++abi.dylib                 0x33e1a078 0x33e19000 + 4216
7   libc++abi.dylib                 0x33e1a110 0x33e19000 + 4368
8   libc++abi.dylib                 0x33e1b594 0x33e19000 + 9620
9   libobjc.A.dylib                 0x33f329cc 0x33f2a000 + 35276
10  CoreFoundation                  0x3405bf1c 0x34053000 + 36636
11  CoreFoundation                  0x3405bd44 0x34053000 + 36164
12  UIKit                           0x3381f7c8 0x337c5000 + 370632
13  UIKit                           0x3381c644 0x337c5000 + 357956
14  Bell Avenue                     0x000832fe main (main.m:13)
15  libdyld.dylib                   0x39d7ab1c 0x39d79000 + 6940

Thread 1:
0   libsystem_kernel.dylib          0x385b6d98 0x385a5000 + 73112
1   libsystem_c.dylib               0x3a624cf6 0x3a61e000 + 27894
2   libsystem_c.dylib               0x3a624a12 0x3a61e000 + 27154
3   libsystem_c.dylib               0x3a6248a0 0x3a61e000 + 26784

Thread 2 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0   libsystem_kernel.dylib          0x385a6648 0x385a5000 + 5704
1   libdispatch.dylib               0x3aee2974 0x3aeda000 + 35188
2   libdispatch.dylib               0x3aee2654 0x3aeda000 + 34388

Thread 3:
0   libsystem_kernel.dylib          0x385b6d98 0x385a5000 + 73112
1   libsystem_c.dylib               0x3a624cf6 0x3a61e000 + 27894
2   libsystem_c.dylib               0x3a624a12 0x3a61e000 + 27154
3   libsystem_c.dylib               0x3a6248a0 0x3a61e000 + 26784

Thread 4 name:  WebThread
Thread 4:
0   libsystem_kernel.dylib          0x385b60fc 0x385a5000 + 69884
1   libsystem_c.dylib               0x3a61f124 0x3a61e000 + 4388
2   WebCore                         0x38db41c0 0x38da8000 + 49600
3   WebCore                         0x38db40f2 0x38da8000 + 49394
4   CoreFoundation                  0x340ea6ca 0x34053000 + 620234
5   CoreFoundation                  0x340e89bc 0x34053000 + 612796
6   CoreFoundation                  0x340e8de8 0x34053000 + 613864
7   CoreFoundation                  0x3405beb8 0x34053000 + 36536
8   CoreFoundation                  0x3405bd44 0x34053000 + 36164
9   WebCore                         0x38db22a8 0x38da8000 + 41640
10  libsystem_c.dylib               0x3a62f30e 0x3a61e000 + 70414
11  libsystem_c.dylib               0x3a62f1d4 0x3a61e000 + 70100

推荐答案

系统导致应用程序中止(SIGABRT).代码中有几个问题:

The system caused the app to abort (SIGABRT). There are several issues in the code:

  1. viewDidLoad中的所有代码应实际上在viewWillAppear:中执行. iOS加载视图时,没有任何代码与执行相关.
  2. self.content = [NSString stringWithContentsOfURL:url]是一个同步调用,它将阻塞主线程多长时间.您应该异步调用此方法,或者使用NSOperationQueue加载内容,然后在主线程上再次进行设置.现在,这阻碍了视图控制器的加载过程,这是一个更糟糕的主意.
  3. 未显示异常消息,但我怀疑您currently对象的类型不是NSString,并且得到了unrecognized selector sent to instance错误.
  1. All code in viewDidLoad should be actually executed in viewWillAppear:. None of the code is relevant to be executed when the view is loaded by iOS.
  2. self.content = [NSString stringWithContentsOfURL:url] is a synchronous call, blocking the main thread for how ever long this takes. You should either call this asynchronously or use an NSOperationQueue to load the content and then set it on the main thread again. Right now this blocks the loading process of the view controller, which is an ever worse idea to do.
  3. The exception message is not shown, but I suspect you the currently object is not of type NSString and it gets an unrecognized selector sent to instance error.

您可能想阅读有关如何阅读和使用崩溃报告的系列文章:

You may want to read this series about how to read and work with crash reports: http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1

这篇关于在iPad上更新了App Crashing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆