iPhone - 应用程序在iOS 3.x(_UIApplicationDidEnterBackgroundNotifi



我的应用程序中有支持iOS 3.0及更高版本的Three20。

当我使用 iOS 3.0、iOS 3.1 运行该应用程序时,该应用程序在启动时立即崩溃。

以下是我的崩溃报告:

Date/Time:       2012-06-26 10:38:36.761 -0600
OS Version:      iPhone OS 3.1.3 (7E18)
Report Version:  104
Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread:  0
Dyld Error Message:
  Symbol not found: _UIApplicationDidEnterBackgroundNotification
  Referenced from: /var/mobile/Applications/8E9E6F79-80BB-4CCD-A510-CCBF7BB78BE8/MyApp.app/MyApp
  Expected in: /System/Library/Frameworks/UIKit.framework/UIKit
  Dyld Version: 149

你知道发生了什么吗,
我在构建设置中缺少某些内容吗?

更新 1:
所以我搜索UIApplicationDidEnterBackgroundNotification
在我的项目中,在TTBaseNavigator.m文件中找到了3个结果。

本部分一个

#ifdef __IPHONE_4_0
UIKIT_EXTERN NSString *const UIApplicationDidEnterBackgroundNotification
__attribute__((weak_import));
UIKIT_EXTERN NSString *const UIApplicationWillEnterForegroundNotification
__attribute__((weak_import));
#endif

和两个在这种方法

- (id)init {
    self = [super init];
  if (self) {
    _URLMap = [[TTURLMap alloc] init];
    _persistenceMode = TTNavigatorPersistenceModeNone;
    NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
    [center addObserver:self
               selector:@selector(applicationWillLeaveForeground:)
                   name:UIApplicationWillTerminateNotification
                 object:nil];
#ifdef __IPHONE_4_0
    if (nil != &UIApplicationDidEnterBackgroundNotification) {
      [center addObserver:self
                 selector:@selector(applicationWillLeaveForeground:)
                     name:UIApplicationDidEnterBackgroundNotification
                   object:nil];
    }
#endif
  }
  return self;
}

您知道如何调整这些代码,以便该应用程序可以在iOS 3.0和iOS 3.1上运行吗?

更新 2:

目前我不使用 TTBaseNavigator,所以我评论了两个 #ifdef __IPHONE_4_0 块。
这解决了我的问题,但我想知道是否有人有其他解决方案可以通过不注释 Three20 代码来完成这项工作。

非常感谢。

UIApplicationDidEnterBackgroundNotification 事件的文档中,它说:"在 iOS 4.0 及更高版本中可用"。

我评论了这两个 #ifdef __IPHONE_4_0 块。 (请参阅更新 1
这解决了我的问题。

最新更新