将 Xcode 的目标设置为 iPhone 而不是 iPad
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2413948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Setting Xcode's target to iPhone NOT iPad
提问by Garry Pettet
I just upgraded to iPhone SDK 3.2 Beta 4. Since doing so, I have not been able to get the app to launch in the iPhone simulator - it keeps launching in the iPad simulator. I have tried option-clicking the drop-down menu in the top left-corner of Xcode and setting 'Active Executable' to iPhone simulator 3.1.3 but it keeps going back to iPad simulator instead.
我刚刚升级到 iPhone SDK 3.2 Beta 4。自从这样做以来,我一直无法让应用程序在 iPhone 模拟器中启动 - 它一直在 iPad 模拟器中启动。我尝试选择单击 Xcode 左上角的下拉菜单并将“Active Executable”设置为 iPhone 模拟器 3.1.3,但它一直回到 iPad 模拟器。
What gives? I have no interest in my app running on the iPad and I don't want to test it in the 2X mode in the simulator.
是什么赋予了?我对在 iPad 上运行的应用程序不感兴趣,我不想在模拟器中以 2X 模式测试它。
Thanks,
谢谢,
采纳答案by user216592
You can't really launch an iPhone app in 3.2.x - sometimes it will pop up - but basically right now it is only for iPad development.
在 3.2.x 中您无法真正启动 iPhone 应用程序 - 有时它会弹出 - 但基本上现在它仅用于 iPad 开发。
回答by Paul Lynch
Update for release version of Simulator.
模拟器发行版的更新。
First of all, the title of this question doesn't match the description: Xcode target isn't the same as the simulator hardware device.
首先,这个问题的标题与描述不符:Xcode target is not the same as the Simulator hardware device。
If you are writing an app targeting 3.2, it can run on both iPad (using OS 3.2) and lower OS versions on the iPhone. You do this by setting the Base SDK to iPhone Device 3.2, the Targeted Device Family to iPhone/iPad, and the iPhone OS Deployment Target to 3.1 (lower than 3.2).
如果您正在编写面向 3.2 的应用程序,它可以在 iPad(使用 OS 3.2)和 iPhone 上较低的操作系统版本上运行。为此,您可以将 Base SDK 设置为 iPhone Device 3.2,将 Targeted Device Family 设置为 iPhone/iPad,将 iPhone OS Deployment Target 设置为 3.1(低于 3.2)。
The iPhone simulator has a menu option for Hardware->Device, which can be set to iPhone or iPad. However, you can only run a 3.2 SDK target in iPad mode, and a Universal app that supports iPad can only use the 3.2 SDK to build.
iPhone模拟器有一个Hardware->Device的菜单选项,可以设置为iPhone或iPad。但是,您只能在 iPad 模式下运行 3.2 SDK 目标,而支持 iPad 的通用应用程序只能使用 3.2 SDK 来构建。
You can of course set the simulator to iPhone mode and launch your app from Springboard, but that will lose the debugger connection. Switching mode during installation of your app will cause it to crash.
您当然可以将模拟器设置为 iPhone 模式并从 Springboard 启动您的应用程序,但这将失去调试器连接。在安装应用程序期间切换模式会导致它崩溃。
So the short answer is still the same: you can't run a Universal iPad app in the iPhone mode simulator while debugging.
所以简短的回答仍然是一样的:你不能在调试时在 iPhone 模式模拟器中运行通用 iPad 应用程序。
回答by Cee Kayel
Upper-left corner of the IDE find a dropdown list of Simulator versions - flipped to 3.2 - try to put it back to 3.1.3
IDE的左上角找到一个模拟器版本的下拉列表-翻转到3.2-尝试将其放回3.1.3
and relaunch your app.
并重新启动您的应用程序。
回答by Robert
This was driving me nuts too, but the answer is right here:
这也让我发疯,但答案就在这里:
http://quatermain.tumblr.com/post/517122761/running-universal-ipad-iphone-apps-in-the-simulator
http://quatermain.tumblr.com/post/517122761/running-universal-ipad-iphone-apps-in-the-simulator
In short, tell Xcode to Buildfor the 3.2 SDK, then switch the build menu to the 3.1 SDK and tell Xcode to Runthe app. Presto, the app starts in the iPhone simulator!
简而言之,告诉 Xcode为 3.2 SDK构建,然后将构建菜单切换到 3.1 SDK 并告诉 Xcode运行应用程序。Presto,应用程序在 iPhone 模拟器中启动!
回答by avance
From Apple's documentation: "iPhone OS 3.2 does not support iPhone and iPod touch devices. It runs only on iPad." There's no way to target 3.2 for iPhone, so there's no Simulator. Ergo, you'll have to wait for iOS 4. Fortunately, that's only 4 days away now... of course it won't support the first generation of iPhone devices, but for all other iPhone users it's a free upgrade. Not sure about iPod Touches.
来自 Apple 的文档:“iPhone OS 3.2 不支持 iPhone 和 iPod touch 设备。它只能在 iPad 上运行。” 没有办法针对 iPhone 3.2,所以没有模拟器。因此,你必须等待 iOS 4。幸运的是,现在只有 4 天了......当然它不会支持第一代 iPhone 设备,但对于所有其他 iPhone 用户来说,它是免费升级。不确定 iPod Touch。
回答by Jacob Relkin
You should be able to change your target platform in your Project Settings.
您应该能够在您的项目设置中更改您的目标平台。
回答by What Eva
Changing the target platform and device makes no difference. It always launches the iPad simulator.
更改目标平台和设备没有任何区别。它总是启动 iPad 模拟器。
If you switch the simulator to iPhone mode, the app just disappears.
如果您将模拟器切换到 iPhone 模式,该应用程序就会消失。
This dev environment is a mess.
这个开发环境一团糟。
回答by live-love
Go to Project Set Active Executable There are 2 options: Ipad Simulator 3.2 or Iphone Simulator 4.0. If you choose the Iphone simulator, then it will launch Iphone simulator. If you choose the Ipad simulator, then it will launch Ipad simulator.
Go to Project Set Active Executable 有两个选项:Ipad Simulator 3.2 或 Iphone Simulator 4.0。如果您选择 Iphone 模拟器,那么它将启动 Iphone 模拟器。如果您选择 Ipad 模拟器,那么它将启动 Ipad 模拟器。
回答by puchikon
I finally solved this problem myself.
我终于自己解决了这个问题。
First, install new version of xCode, which is xCode 4.
首先,安装新版本的 xCode,即 xCode 4。
Then set project scheme to iphone simulator and run app in xCode several times.
然后将项目方案设置为 iphone 模拟器并在 xCode 中多次运行应用程序。
And re-install xCode 3 and the problem will be gone away!
并重新安装 xCode 3,问题就会消失!
回答by user325644
Short answer: You can change the hardware setting in the simulator. Hardware->Device
简短回答:您可以更改模拟器中的硬件设置。硬件->设备