应用程序在启动时崩溃

App Crashed on start

我的应用程序在启动时崩溃,只有当我从设备构建 & 运行 时才会发生这种情况,因为通过 Xcode 它工作正常。

这是我的崩溃日志。 Crash Log

我知道发生这种情况是因为我的应用没有及时加载并且 iOS 因为它花费的时间超过允许的时间限制而终止了它。

从崩溃日志中我了解到它是由于 ImageLoader 而发生的,但我在启动时没有执行任何重负载。

这是我的启动方法:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    [[UINavigationBar appearance] setTranslucent:NO];
    [[UINavigationBar appearance] setTintColor:kUIColorWhite];
    [[UINavigationBar appearance] setBarTintColor:kUIColorGreenTheme];
    NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:kUIColorWhite,NSForegroundColorAttributeName, nil];
    [[UINavigationBar appearance] setTitleTextAttributes:textTitleOptions];

    [self startRechabilityMonitoring];

    // Create Reports database & tables if not exist
    [[SPDBManager sharedInstance] checkAndCreateDatabase];
    [[SPDBManager sharedInstance] createTables];
    return YES;
}

非常感谢任何帮助。

终于搞定了。

在编辑方案中 Xcode 7 项调试崩溃的新功能称为 "Address Sanitizer"。 当你不是 运行 到 Xcode.

时应该禁用它

从这里得到我的答案: