如何限制仅适用于 iPhone 的 iOS 应用程序(iPad 除外)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24927716/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 01:31:55  来源:igfitidea点击:

How to Restrict the iOS app only for iPhone excluding iPad?

iosiphoneipad

提问by Code cracker

I want to restrict my app only for iPhone. I don't want my app is available for iPad.

我想限制我的应用程序仅适用于 iPhone。我不希望我的应用程序可用于 iPad。

采纳答案by JIthin

You can't restrict an application to run on iPhone only in the normal way.The iOS is designed such a way that the iPhone apps will run on iPad in 1x resolution .

您不能限制应用程序只能以正常方式在 iPhone 上运行。iOS 的设计方式是 iPhone 应用程序将在 iPad 上以 1x 分辨率运行。

However if you really want to restrict your app to iPhone , you canachieve this by stating that the app requires feature telephony to work by specifying the same in UIRequiredDeviceCapabilities. This means it will only work on an iPhone.

但是,如果您真的想将您的应用程序限制在 iPhone 上,您可以通过在UIRequiredDeviceCapabilities 中指定应用程序需要功能电话才能工作实现这一点。这意味着它只能在 iPhone 上运行。

回答by Jim Tierney

YES, yes, you CAN, set the UIRequiredDeviceCapabilities stating that the app requires telephony. This means it will only work on an iPhone. Please read more about it from the Apple Documentation here -

是的,是的,您可以,设置 UIRequiredDeviceCapabilities 声明应用程序需要电话。这意味着它只能在 iPhone 上运行。请从此处的 Apple 文档中阅读更多相关信息 -

UIRequiredDeviceCapabilities - setting conditions so app store knows which devices to allow installation on

UIRequiredDeviceCapabilities - 设置条件,以便应用商店知道允许安装的设备

Within this page, search for UIRequiredDeviceCapabilites and it will tell you more from there.

在此页面中,搜索 UIRequiredDeviceCapabilites,它会从那里告诉您更多信息。

I hope this helps anyone with this issue

我希望这可以帮助任何有此问题的人

回答by Infinity James

You can't disable the iPad's ability to run your iPhone app.

您无法禁用 iPad 运行 iPhone 应用程序的能力。

回答by zeucxb

Add TARGETED_DEVICE_FAMILY = 1;at project.pbxprod

添加TARGETED_DEVICE_FAMILY = 1;project.pbxprod

In other words change TARGETED_DEVICE_FAMILY = "1,2"to TARGETED_DEVICE_FAMILY = 1;

换句话说,更改TARGETED_DEVICE_FAMILY = "1,2"TARGETED_DEVICE_FAMILY = 1;

回答by Wes

In your info.plist, add the following:

在您的 info.plist 中,添加以下内容:

<key>UIDeviceFamily</key>
<array>
  <integer>1</integer>
</array>

1 = iphone and ipod, 2 = ipad

1 = iphone 和 ipod,2 = ipad