【问题标题】:Application is working in iOS4.0 or higher but it's crashing immediately after launch on device 3.1.3 or lower应用程序在 iOS4.0 或更高版本中运行,但在 3.1.3 或更低版本的设备上启动后立即崩溃
【发布时间】:2010-09-19 11:11:03
【问题描述】:

我的应用程序在 iOS 4.0 或更高版本上运行良好,但在设备 3.1.3 或更低版本上启动后立即崩溃。我已将“Base SDK”设置为“4.1”,将“Deployment Target”设置为“3.0”。

崩溃日志 -

Dyld 错误消息: 未找到符号:_UIKeyboardFrameEndUserInfoKey 引用自:/var/mobile/Applications/FE470A03-6285-48E4-B188-A0023500AA84/XXX 预期在:/System/Library/Frameworks/UIKit.framework/UIKit dyld 版本:149

我与新框架的链接很弱。

非常感谢任何帮助。

问候, 阿米特

【问题讨论】:

    标签: iphone ios4


    【解决方案1】:

    常量 UIKeyboardFrameEndUserInfoKey 是在 iOS 3.2 中引入的。所以它在 3.1.3 设备上不可用。此外,该常量是在 UIKit 框架中定义的。所以弱链接到 new 框架是不够的,因为 UIKit 是一个 old 框架。

    我看到两个选项:

    1. 切换到 UIKit 的弱链接(并确保该常量不在旧设备上使用)。

    2. UIKeyboardFrameEndUserInfoKey 的使用替换为 UIKeyboardBoundsUserInfoKey。它已被弃用并且工作方式略有不同。但它仍然有效。

    【讨论】:

    • 我会尝试弱链接 UIKit。但我确信我没有在我的项目中使用 UIKeyboardFrameEndUserInfoKey。感谢您的回答。
    【解决方案2】:

    弱链接“UIKit”框架成功了。另一条使应用程序崩溃的行是使用“UIApplicationWillEnterForegroundNotification”而不检查它是否可用。 以下检查已解决该问题。

        if (&UIApplicationWillEnterForegroundNotification != NULL) {
    //Register for a notifiation when application enter into foreground state
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadVCData:) name:UIApplicationWillEnterForegroundNotification object:nil];
    }
    

    问候, 阿米特

    【讨论】:

    • 感谢 Amit,我不确定如何检查。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-26
    • 2011-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-28
    相关资源
    最近更新 更多