简体   繁体   中英

Is it possible to use iPhone Simulator 3.1 from XCode 3.2.3?

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, eg 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, eg

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) ???

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM