tags:

views:

364

answers:

1

In one of my builds for an iPhone app, I had inadvertently created a variable that shadowed a variable in the scope above it. This was unintentional, but compiled since Objective-C apparently allows shadowing of variables between an if block and its containing method.

When I sent out this code, people that were using iPhone 3Gs immediately encountered problems, but people using 2Gs didn't have any apparent problems.

Does anyone happen to know if there are actual OS differences for these two models? Do 2Gs have compile-time, static memory allocation, somehow?

This was a huge point of confusion, since I only had a 2G development device, and never encountered a problem, even though theoretically, the code should not have worked as expected.

Now, there are a couple of other differences in that the 3Gs were using builds targetting an AdHoc build, while the ones the 2Gs were using were targetted for Release.

+1  A: 

There shouldn't be any differences, they use the same processors and I believe the same RAM. They are practically the same platform. The OS is literally the same - if you force it, an iPhone 3G IPSW can be restored to a 2G (and vice versa) and it will work perfectly (note if you unzip the IPSW and look inside an iPhone build it contains NOR files for both platforms).

It could be coincidence, in that your users could have had different versions of the OS, or it could be a difference between your ad hoc build and your release.

AriX
Hmm, thanks. I realize the OS itself is the same, but this does not mean the underlying memory architecture does precisely the same thing. The question came about because of a weird event in the case of Shadowing (bad practice I know, it was a bug that didn't get caught until release...). I'm wondering if I should be modifying a static analyzer to look for shadowing or something...
Sam
There are no differences that you are allowed to be aware of by Apple, and therefore you probably don't need to be. I believe the application level processing system is exactly the same between the two models. The difference must have been the build setting, or if they were running a different OS version.
AriX
(Or just a coincidence)
AriX