iOS - 崩溃日志 - 0x8badf00d - 导致此问题的原因是什么?

时间:2013-08-26 15:55:13

标签: ios objective-c logging crash

我意识到错误日志告诉我的是什么。有一个地方苹果正在关闭我的应用程序。启动,启动或关闭需要很长时间。我似乎无法弄清楚这发生在哪里。我需要从这个线程和/或这些方法中移出什么?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

  [self preload];

  [NSThread sleepForTimeInterval:1.5];

  [window addSubview:[viewController view]];
  [NSNotificationCenter postNavigationNotificationForName:whatever];
  [window makeKeyAndVisible];

    return YES;

}

-(void)preload
{

        [[[UIWebView alloc] init] release];

    if (interface == iPad)
    {
        UIViewController *dummy = [[[UIViewController alloc] init] autorelease];
        [[[UIPopoverController alloc] initWithContentViewController:dummy] release];
    }

    [[NSNotificationCenter defaultCenter] addObserver:self 
                                       selector:@selector(preloadComplete:)
                                           name:UIWindowDidBecomeVisibleNotification
                                         object:nil];
    UITextField *field = [[[UITextField alloc] init] autorelease];
[window addSubview:field];
[field becomeFirstResponder];
[field resignFirstResponder];
[field removeFromSuperview];
[[NSNotificationCenter defaultCenter] removeObserver:self 
                                              name:UIWindowDidBecomeVisibleNotification
                                            object:nil];

}

- (void)applicationWillTerminate:(UIApplication *)application
{
  NSError *err = nil;
  [[context sharedInstance] cleanup];
    [[[[context sharedInstance] user] managedObjectContext] save:&err];

}

- (void)applicationWillResignActive:(UIApplication *)application
{
  NSError *err = nil;
[[[[context sharedInstance] user] managedObjectContext] save:&err];

}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
  context *ctx = [context sharedInstance];
  if (ctx) {
    [ctx makeSureYouCanReachThis];
  }

  if ([[ctx user] userState] != userStateUnknownUser) {
    NSTimeInterval ti = time;
    if (fabs([[ctx dateLaunched] timeIntervalSinceNow]) > ti)
    {
      [ctx setDateLaunched:[NSDate date]];
      [[ctx user] becomeFault];
      [[ctx user] delayedBackgroundAuth];
      [ctx authenticateUser:[[ctx user] defaultUsername]
           withPassword:[[ctx user] defaultPassword]];
    } 
    else
    {

      {
        if (fabs([[ctx lastBecameActive] timeIntervalSinceNow]) >= time) 
        {
          [ctx setLastBecameActive:[NSDate date]];
          [ctx synchServerCompleted];
        }
      }
      else
      {
        [ctx setLastBecameActive:[NSDate date]];
      }
    }
  }

}

0 个答案:

没有答案