1

I just created a UIStepper programmatically and added it to my view. in IOS 5 simulator it is working fine.

In IOS 4.3 simulator it is not showing up. Ok, becuase it is not supported in 4.3 , it seems fine. But app is not getting crashed.

Can anyone explain why ??

Thanks -Mia

mia
  • 373
  • 1
  • 4
  • 15
  • 1
    Can you explain why you asking such a question... – Andrew Jan 31 '12 at 13:21
  • ya sure.. I was just trying out weak linking. As this class is missing in 4.3 , i want to know whether I need to weak link UIKit framework and use NSClassFromString so as to normally work in 4.3 or just use NSClassFromString only to check the availability and handle accordingly. – mia Jan 31 '12 at 13:39

2 Answers2

6

So Stephen is correct to say you shouldn't take what happens on the simulator as gospel, but in this case that's not what's happening.

The reason it doesn't crash is that UIStepper actually exists on iOS 4.3 - it's just not implemented. It's a private, undocumented class (you can view the 4.3 private framework headers here). Presumably Apple started integrating it into 4.3, but only made it public in 5. This happens a fair bit: gesture recognizers had been kicking around iOS for some time before they were publically released for iOS 3.2

lxt
  • 31,146
  • 5
  • 78
  • 83
  • Thank You lxt ! Can u please answer my doubt on weak linking too ?? JUst want to know we need to weak link only if the whole frame work is missing OR we need to weak link when a class in framework is missing. In the case of selector missing case we do not have to weak link and i have tried and confirmed that. – mia Feb 01 '12 at 03:55
1

It's a simulator not an emulator. Operations will be similar to but not the same as on an actual iPhone. In this case I wouldn't expect the same behavior on a real device.

Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
  • ...somewhat true, but it would be really unusual for the simulator not to fail in this case. It's one of the reasons why Apple ships simulators for different iOS versions. – lxt Jan 31 '12 at 13:36