Prevent iPhone app to run on iPad

2020-01-24 17:35发布

问题:

I'm shipping two binaries; one for iPhone/iTouch and the other for iPad. It's the same application.

Will Apple ensure that the user will never receive an iPhone version of the app on the iPad? If YES, then I don't have anything to worry about, but if not then I do have a problem.

The reason I ask is the iPhone application will simply not work correctly on the iPad because the server knows it's an iPad and will deliver the iPad HD content to it and the iPhone cannot handle that. I would rather not hack my application to send the server a fake device type if running the iPhone app on the iPad in order to receive the correct resources.

Suggestions?

回答1:

I've been looking for this for a while because I couldn't prevent the iPhone app to load on the iPad. Searched a bit to understand why this was happening, followed @hotpaw2 instructions and found this on the official apple store rules:

UPDATE:

2.4.1 To ensure people get the most out of your app, iPhone apps should run on iPad whenever possible. We encourage you to consider building universal apps so customers can use them on all of their devices. Learn more about Universal apps.

https://developer.apple.com/app-store/review/guidelines/



回答2:

The SDK and/or App store rules prohibit you from preventing an iPhone app from running on an iPad in 1X or 2X zoom mode, unless there are other requirements listed in the app plist. Apple's app review is known to test iPhone-only app submissions (unless there are other requirements) on an iPad, and reject the app if it doesn't run properly.

Other requirements (as listed under UIRequiredDeviceCapabilities in the app's plist) might include your app requiring telephone capabilities (or healthkit, etc.), which might help you temporarily, but still won't prevent the app from running on some hypothetical future iPad product that includes telephony capabilities (and/or healthkit, etc.).



回答3:

Actually you can.
Add telephony to UIRequiredDeviceCapabilities in your plist file.

But i really not recommend it and maybe you could get rejected because of gratuitously using this property.

I think you should handle that there are iPad versions and iPhone versions on iPads, use the second one as an iPhone.
Also don't forget that retina iPads will use upscaled applications at retina resolution while none retina ones use the standard resolution. And this behavior can tweaked using jailbreak tweaks like RetinaPad and FullForce.



回答4:

In the plist settings, add Application requires iPhone environment and set the boolean to YES