Specify device family in Info.plist

时光毁灭记忆、已成空白 提交于 2019-12-07 14:37:34

问题


Is there a way to specify the device family solely based on a key in Info.plist, without changing the build settings? I have read about UIDeviceFamily being added automatically to Info.plist at build time, and the documentation says that I should not add this key manually. Let's say I cannot use Xcode, but I can edit Info.plist, is there a way to specify if the app should be running only on iPhone (or iPad)?

Thank you,


回答1:


check out the docs in UIDeviceFamily

UIDeviceFamily

if you need to only support ipad, set the DeviceFamily to 2. For iphone set to 1. For universe include both 1 and 2




回答2:


As you mentioned, you should not add UIDeviceFamily in Info.plist. However, if you are generating bulid from commandline, you can set TARGETED_DEVICE_FAMILY, "1" for iPhone and "2" for iPad:

xcodebuild \
  -target "${TARGET}" \
  -configuration ${CONFIGURATION} \
  -sdk iphoneos \
  TARGETED_DEVICE_FAMILY="2" 


来源:https://stackoverflow.com/questions/18075311/specify-device-family-in-info-plist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!