0

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

当我使用 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 代码来完成这项工作。

非常感谢。

4

2 回答 2

2

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

于 2012-06-26T18:22:33.937 回答
0

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

于 2012-07-16T14:43:46.990 回答