tags:

views:

106

answers:

2

I've an application which is working fine on iOS 4.0 or higher but keep crashing immediately after launch on device 3.1.3 or lower. I've set "Base SDK" to "4.1" and "Deployment Target" to "3.0".

Crash Log -

Dyld Error Message: Symbol not found: _UIKeyboardFrameEndUserInfoKey Referenced from: /var/mobile/Applications/FE470A03-6285-48E4-B188-A0023500AA84/XXX Expected in: /System/Library/Frameworks/UIKit.framework/UIKit Dyld Version: 149

I've weak linking to new frameworks.

Any help greatly appreciated.

Regards, Amit

+2  A: 

The constant UIKeyboardFrameEndUserInfoKey was introduced with iOS 3.2. So it's not available on a 3.1.3 device. Furthermore, the constant is defined in the UIKit framework. So weakly linking to new frameworks is not sufficient because UIKit is an old framework.

I see two options:

  1. Switch to weak linking for UIKit (and make sure the constant isn't used on older devices).

  2. Replace the use of UIKeyboardFrameEndUserInfoKey with UIKeyboardBoundsUserInfoKey. It's deprecated and works slightly differently. But it still works.

Codo
I'll try weak linking UIKit.but I am sure I haven't used UIKeyboardFrameEndUserInfoKey in my project. Thanks for the answer.
Amit Vaghela
A: 

Weak Linking "UIKit" framework did the trick. And one more line that crashing a application was using "UIApplicationWillEnterForegroundNotification" without checking whether it's available or not. Following checking has fixed that issue.

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

Regards, Amit

Amit Vaghela