Re: How to get iOS version at runtime?
Re: How to get iOS version at runtime?
- Subject: Re: How to get iOS version at runtime?
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Fri, 18 Jul 2014 22:09:16 +0700
On 18 Jul 2014, at 20:30, Roland King <email@hidden> wrote:
>
>> On 18 Jul 2014, at 3:40 pm, Gerriet M. Denkmann <email@hidden> wrote:
>>
>> How to get iOS version at runtime?
>>
>> Like:
>>
>> BOOL isRunningOnDeviceOrSimulatorInVersion8 = ???
>>
>> I seem to have asked this question before (about OS X) and was told to use either NSAppKitVersionNumber or NSFoundationVersionNumber.
>>
>> iOS obviously has no NSAppKitVersionNumber, but I cannot find a UIKitVersionNumber.
>>
>> The stuff which behaves differently in 7.1.2 versus 8.0 is UIKeyboardWillChangeFrameNotification, which looks more like UIKit.
>> Should I use NSFoundationVersionNumber anyway or what?
>>
>> And: does the Simulator return the NSFoundationVersionNumber of the simulated iOS (8.0) or the machine it is running on (10.9.4)?
>>
>> ProcessInfo has operatingSystemVersionString which is documented as "not appropriate for parsing".
>>
>> Gerriet.
>>
>
>
> The easy answer is you’re not supposed to do it because it’s fragile and guaranteed to break.
If 7.1.2 and 8.0 behave differently, I have no option other doing this fragile stuff.
>
> You’re also not supposed to have to do it.
In an ideal world this would probably be true.
And I certainly could wait until all bugs have been fixed by Apple.
But I am kind of impatient.
>
> I wish I could ever remember how compatibility is meant to work. If you build for minimum target 7 but run on 8, isn’t the API your code ‘sees’ supposed to be ‘compatible with 7’ or is it allowed to give you a UIKeyboardWillChangeFrameNotification which looks like iOS8? That could just be a bug.
I am using:
Base SDK = Latest = 8.0
iOS Deployment Target = 7.1
7.1.2 and 8.0 (the latter tested only in Simulator) differ in two points (as regarding UIKeyboardWill...Notifications):
1. the amount of Notifications differ.
To figure out, how to change the height of my UITextView when a keyboard comes, goes or changes its size, I use:
- in 7.1.2 "WillShow" and "WillHide"
- in 8.0 "WillChangeFrame"
2. these Notifications have two rects in their userInfo: UIKeyboardFrameEnd and UIKeyboardFrameBegin.
In 7.1.2 these are always in the portrait orientation. To be usable one has to rotate them to the actual orientation.
In 8.0 they are already in the actual orientation (much more sensible)
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden