Welcome, Guest
Username Password: Remember me

iOS 3.1.2 Test Problem
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: iOS 3.1.2 Test Problem

iOS 3.1.2 Test Problem 1 year, 6 months ago #1

Hi,

I'm trying to test my application with a 3.1.2 iphone, however once I have tap a textfield or textview which means the keyboard popping out, I'm getting a "EXC_BAD_ACCESS" error. The selection and date cells seems to work fine. I don't know if any other feature of sensible cocoa raises any problem.

Here is the code which XCode shows the problem:
 
#ifdef __IPHONE_3_2
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;***********
#else
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue].size;
#endif
 


I have marked the line of the problem with "***". Thanks for your help, I hope it's a solveable one.

Oguz
  • leweo
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Karma: 0

Re: iOS 3.1.2 Test Problem 1 year, 6 months ago #2

This occurs because even though your target deployment OS is 3.1.2, the base SDK that you're using is probably 4.0 or 4.1, and thus __IPHONE_3_2 is defined. To target older devices (OS less than 3.2) while using a newer SDK like the one you're using, you'll have to modify the code:

 
#ifdef __IPHONE_3_2
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
#else
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue].size;
#endif
 


To the following code:

 
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue].size;
 


Note: we could check the system version using [[UIDevice currentDevice] systemVersion] and do this call automatically, but including the code [userInfo objectForKey:UIKeyboardBoundsUserInfoKey] will have STV's code generate a compiler warning "UIKeyboardBoundsUserInfoKey is deprecated". Since the vast majority of our users are not deploying on 3.1.x devices, we do not wish to flood their screen with compiler warnings at build time.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.69 seconds