views:

1422

answers:

2

Because the Simulator 3.2 and 4.0 in the SDK 4 do NOT actually work for iPhone simulation (which always comes out iPad and not responding at all), I ended up with 2 SDK installations, using SDK 3.1.3/Simulator 3.1 for simulation, and SDK 4 for building onto the iPhone with OS 4. (More details here.)

I tried to use the old Simulator 3.1 from the SDK4-XCode 3.2.3, e.g. by copying the full "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk" directory into the corresponding XCode3.2.3 directory, and choose the Simulator-3.1.3 (which does appear in the "Active Executable" list), but it cannot build, with more than 30 errors, e.g.

Undefined symbols:
"_OBJC_CLASS_$_NSURLConnection", referenced from: objc-class-ref-to-NSURLConnection in GRACEViewController.o
"_OBJC_CLASS_$_NSString", referenced from: objc-class-ref-to-NSString in GRACEViewController.o

Is there a way to use Simulator 3.1 (instead of Simulator 3.2 or 4.0) when using XCode 3.2.3 (which is a must to build into iPhones on OS 4) ???

+4  A: 

XCode 3.2.3 does do iPhone simulation. You need to make sure that your project settings are correct though. I have the following settings and it works for me:

  • Base SDK: iPhone Device 4.0
  • Targeted Device Family: iPhone
  • Deployment Target: iPhone OS 3.0

With that, you should have the option to run your project in the iPhone Simulator.

keno
I had some trouble after upgrading, as my older project would no longer build or run. The menu selections weren't working. I had to go into the Target's info and make the settings there.
mbmcavoy
I have the same settings, and while I can run in the simulator, the simulator is emulating iOS4. The only options in the Hardware->Version menu are 4.0 and 3.2 (which switches it to the iPad simulator). I think the OP was looking for a way to test 3.1 compatibility in the 4.0 simulator.
chrispix
I see what you're saying now. You will need an actual device running 3.1.x to test compatibility. This apple dev forum thread may provide further insight: https://devforums.apple.com/message/244347
keno
No, I tried the setting but the Simulator executable generated by "Base SDK Device/Simulator 4.0" does not work at all, i.e. table do not scroll, map does not pan, etc.For example it has also another problem e.g. the alertView window is put in the wrong position BEFORE the keyboard is popped up:http://www.iphonedevsdk.com/forum/iphone-sdk-development/51160-alertview-too-high-os4.html#post218320
lionfly
A: 

I find that by fully protecting any OS3.2 code, I can choose to compile as either 3.1.3 or 3.2 simply by changing the Active SDK when I compile. The 3.1.3 will always come up in the iPhone Simulator and the 3.2 will always come up in the iPad simulator.

Here's an example of fully protected code:

    #ifdef UI_USER_INTERFACE_IDIOM
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// iPad Only Code Goes here
            [deviceType setString:@"ipad"];
        } else {
    #endif
// iPhone Only Code Goes Here
            [deviceType setString:@"iphone"];
    #ifdef UI_USER_INTERFACE_IDIOM
        }
    #endif
Shannon A.