iosiphonexcodeswift2xcode7-beta5

How to selectively choose compatible devices with Xcode 7.5 beta


I am currently developing with Xcode 7.5 betas and Swift 2. I have chosen for my project to run on all iPhones. However, I do not want to run it on iPhone 4s as the screen size is too small. Is there anyway I can have it run on iPhone 5 - 6s only?


Solution

  • You can limit what iPhones can run your app using the information property list (Info.plist) file. "The UIRequiredDeviceCapabilities key lets you declare the hardware or specific capabilities that your app needs in order to run" however, this is based on handset capabilities not characteristics. It won't let you limit the applicability by screen size but you can get a similar result by finding common capabilities in your targeted handsets that aren't shared by the hardware you want to rule out.

    Use the Device Compatibility Matrix linked below. Although I'm not sure how you can rule out the 4s, without ruling out the 4, there are a couple options for ruling out all iPhones prior to the 5S.

    Good luck!

    https://developer.apple.com/library/prerelease/ios/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html#//apple_ref/doc/uid/TP40013599-CH17-SW1