简体   繁体   English

是否可以使用XCode 3.2.3中的iPhone模拟器3.1?

[英]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 .) 因为SDK 4中的模拟器3.2和4.0实际上不适用于iPhone模拟(它总是出现在iPad上而根本没有响应),我最终安装了2个SDK,使用SDK 3.1.3 / Simulator 3.1进行模拟, SDK 4用于在OS 4上构建到iPhone 4.(更多细节请点击此处 。)

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 我尝试使用SDK4-XCode 3.2.3中的旧模拟器3.1,例如将完整的“iPhoneSimulator.platform / Developer / SDKs / iPhoneSimulator3.1.3.sdk”目录复制到相应的XCode3.2.3目录中,然后选择模拟器-3.1.3(确实出现在“Active Executable”列表中),但它无法构建,超过30个错误,例如

Undefined symbols: 未定义的符号:
"_OBJC_CLASS_$_NSURLConnection", referenced from: objc-class-ref-to-NSURLConnection in GRACEViewController.o “_OBJC_CLASS _ $ _ NSURLConnection”,引自:GRACEViewController.o中的objc-class-ref-to-NSURLConnection
"_OBJC_CLASS_$_NSString", referenced from: objc-class-ref-to-NSString in GRACEViewController.o “_OBJC_CLASS _ $ _ NSString”,引自:GRACEViewController.o中的objc-class-ref-to-NSString

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时使用模拟器3.1(而不是模拟器3.2或4.0)(必须在OS 4上构建iPhone)?

XCode 3.2.3 does do iPhone simulation. XCode 3.2.3确实做了iPhone模拟。 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 基础SDK: iPhone设备4.0
  • Targeted Device Family: iPhone 目标设备系列: iPhone
  • Deployment Target: iPhone OS 3.0 部署目标: iPhone OS 3.0

With that, you should have the option to run your project in the iPhone Simulator. 有了它,您应该可以选择在iPhone模拟器中运行您的项目。

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. 我发现通过完全保护任何OS3.2代码,我可以选择编译为3.1.3或3.2,只需在编译时更改Active SDK即可。 The 3.1.3 will always come up in the iPhone Simulator and the 3.2 will always come up in the iPad simulator. 3.1.3将始终出现在iPhone模拟器中,3.2将始终出现在iPad模拟器中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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