在 iPod Touch 上运行的 iPhone 应用程序
如果我为 iPhone (OS 3) 创建一个应用程序,它是否可以在 iPod Touch 上无需修改地运行,或者我是否需要创建一个单独的二进制文件?如果是相同的运行时,它是否仅具有仅适用于 iPhone 功能的存根,或者您是否必须使用 UIDevice 逐个功能检查以确保设备支持特定的类/方法以避免崩溃?
对于基本问题感到抱歉,在任何地方都找不到对此的简单解释。
欢呼
戴夫
编辑:基于以下讨论:
如何检查设备是否支持拨打电话?目前我假设它不是 iPod Touch。有没有办法找出设备支持哪些共享应用程序/URL 方案?
If I create an App for the iPhone (OS 3) will it run without modification on an iPod Touch or will I need to create a separate binary? If it is the same runtime, does it just have stubs for the iPhone only features or do you have to check feature by feature using UIDevice to ensure the particular class/method is supported on the device to avoid a crash?
Sorry for the elementary questions, can't find a simple explanation of this anywhere.
Cheers
Dave
EDITED: Based on discussions below:
How can you check if a device supports making calls? At the moment I am assuming if it is an iPod Touch it can't. Is there a way of finding out what shared applications/URL schemes are supported by a device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不应该真正尝试猜测该设备是什么。如果您测试您尝试使用的特定功能,您将更加面向未来。毕竟,未来可能会出现带摄像头的 iPod。或者指南针(某些 iPhone 上有,但其他 iPhone 上没有)。
既然听起来您只想查看是否可以打开 URL,为什么不使用
-[UIApplication canOpenURL:]
呢? (这可能适用于具有可以处理 VOIP 的应用程序的 iPod touch——我不知道是否存在这样的应用程序,但我认为这是一个例子,说明为什么您需要测试功能而不是基于硬件或操作系统做出假设版本。)You shouldn't really try to guess what the device is. You're far more future-proof if you test for the specific functionality you're trying to use. After all, in the future there might be iPods with cameras. Or compasses (which are on some iPhones but not others).
Since it sounds like all you want to do is see if you can open a URL, why not use
-[UIApplication canOpenURL:]
? (This would presumably work on iPod touches that had applications that could handle VOIP -- I don't know if any such exist, but I think it's an example of why you need to test for functionality and not make assumptions based on hardware or OS version.)该应用程序将在 iPod touch 上运行,无需编译单独的版本。显然,需要 iPhone 的功能(例如相机)将无法使用。
您打算使用哪些此类功能?您可以为 iPod 用户提供替代方案或提醒他们,例如没有可用的相机。
此问题解决如何检查麦克风是否存在:检测 iPhone iPod touch 配件
The app will run on an iPod touch, no need to compile a separate version. Features that require an iPhone (e.g. camera) will not work, obviously.
What such features do you intend to use? You may provide alternatives for iPod users or alert them that e.g. no camera is available.
This question adresses how to check if a microphone is present: Detecting iPhone iPod touch accessories