[英]iPhone - App crashes on start up on iOS 3.x (_UIApplicationDidEnterBackgroundNotification)
我的應用程序中有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代碼來完成這項工作。
非常感謝。
在UIApplicationDidEnterBackgroundNotification
事件的文檔中,它說“在iOS 4.0及更高版本中可用”。
我評論了兩個#ifdef __IPHONE_4_0塊。 (請參閱更新1 )
這解決了我的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.