views:

309

answers:

3

Hi Guys, Sorry for the long post....

I'm trying to understand if the behavior I'm getting on my app is "normal". I have an app developed against the 2.0 sdk version (i.e. to make sure max #of devices can run it, as I don't use any "special" 3.0 features I tend to think the lowest denominator must be the best choice).

So In Xcode (latest version of xcode) I make sure everything is set towards the 2.0 api, including the framework references. I build and the thing runs fine on 2.1 device (hardware is the 1gen iPhone). Now i test it on a device that is old hardware (iPod touch) but latest software 3.0

The thing runs fine, but I experience different behavior in some places, example: 1) toolbar animation does not work 2) rotation behaves differently (rotating the device to the right shows my screen mirrored.. :-) which is "cool" but not desired

Now, I'm sure I can "hack" around and fix these issues, but something just doesn't make sense to me and it is usually where I know I don't understand something to its fullest,

THE QUESTION IS: isn't any device that runs something that was compiled against 2.0 must behave exactly the same regardless of its current software version/ hardware version? Isn't this the whole thing about backward compatibility? I would expect that 3.0 device running a 2.0 software would experience the exact same flow as a 2.0 device running a 2.0 software. What am I missing? and where is the lack of understanding from my side?

thanx, -tzurs

A: 

Mostly it does behave the same, but there are some cases (especially around rotation) where it's simply a bit different. They also may well have re-ordered views in a toolbar or navigation bar so if you were manipulating subviews of those kinds of things directly, they will have changed.

It could also be you are relying on bugs that exist in 2.0 and if you do something the "correct" way you'll not have any issues from 2.0 to 3.0.

Around rotation specifically, if you are using shouldAutoRotate... as a trigger to do something look at using the rotation notifications instead.

Kendall Helmstetter Gelner
Thanks for the reply,per your question, I'm not using any "known bugs" or anything non standard, my rotation code is very straight forward actually and works fine on both hardware other than the fact that on the 3.0 device the rotation to the right shows the whole view flipped. the animation I use in the tabbarcontroller is also very straight forward but does not work in the 3.0. anyhow, all these are not the important thing that I'm after, its the "why at all should there be a difference!!" I thought 3.0 would use the exact code as 2.0.
Tzur
The frameworks underneath have all changed substantially over time. I have heard from Apple people that some frameworks will slightly adjust behavior if they see the app is compiled for an earlier version of the code, but it's impossible to do huge re-writes of frameworks and have them 100% functionally equivalent for older apps. That is the whole reason Apple has beta releases, so you can adapt for things that no longer work the same way.
Kendall Helmstetter Gelner
I was under the impression they just keep a version of the relevant libraries on the new device. or something like that. never bothered myself with how they do it..I assumed its a "promise" by the OS that it runs the exact same code somehow. my bad I guess.
Tzur
A: 

isn't any device that runs something that was compiled against 2.0 must behave exactly the same regardless of its current software version/ hardware version? Isn't this the whole thing about backward compatibility?

A bit tongue-in-cheek, but In the Microsoft world this would make sense. However, the Apple world doesn't traditionally place as much value on backward compatibility. Especially when it comes to behavior due to bugs in a previous release or due to using things in ways they weren't originally intended to be used.

Eric Petroelje
hmm.So you're saying that 3.0 does not run the exact code when asked to run a 2.0 api function?That would be surprisingly unheard of in the 20 years I'm coding.. :-) but if you say it, you know what you're talking about. I'm now puzzled as to what can be done then to support my app in future versions. should I be looking at some release notes for say 3.0 saying its 2.0 implementation is breaking compatibility with the "original" 2.0? is there perhaps such a document you know of?
Tzur
Why is that surprising? I've been coding longer than you and that's how it has always been. When I make a system call in UNIX am I calling code from 1970? Or am I calling a version that may have altered utterly underneath. Why else would you have API's if the code underneath did *not* change? You have API's so that it can, when newer library versions come out you do compatibility testing to make sure assumptions you made are still correct.
Kendall Helmstetter Gelner
that a good point, I may have not explained myself correctly.if I call an api method from 1970 that adds two numbers and returns the result, I want to keep calling it and get the same result back even when I compile against a library compiled last week and claims it maintains the api of the 70s (the good old days). the whole point about backward compatible is that developers and software companies do not need to "check" with beta versions that their code, written "fantastically" and was working for years is now not "compatible". the new os is not compatible, not the software..
Tzur
I would even go further, suppose I purchased and app for my iPhone when it was 2.0, now I upgraded (it said "backwards comp) now the app I have installed does not work anymore?!@! I need to talk to the company I bought it from and "make" them compile it for the new OS?To me this makes very little sense. my 2 cents.
Tzur
Yes it's easy to take a method call that simply adds two numbers and have it always return the same result. But when you take an API that interacts with many other elements of the system, that is not possible - you'd have to have a whole copy of the entire OS for every revision forever, and guarantee on top of that that the multiple versions running at the same time with different apps (say your app and Mail, which runs in the background at times) would not interfere with each other.
Kendall Helmstetter Gelner
You are absolutely correct. I'm truly not trying to be cynical, before you guys replied I was sure I'm simply doing something wrong. Now I understand I simply expected something else from the term back-compatible. Its simply not. Now I understand I need to figure out the specifics of what I'm doing wrong that works for 2.0 and break for 3.0 running the same code. Hmm. I think. Meditate on this I will.
Tzur
A: 

The easiest place to see what changed is the diffs, or differences. This are published as part of the documentation sets on each release and show what changed, and how to respond to supporting different versions. Also check out Apple's sample code on supporting multiple versions.

JoePasq