How do I set compatible devices to only ARKit comp

2020-08-25 05:22发布

问题:

How can I make sure my app on iOS AppStore only show compatibility for ARKit enabled devices only?

回答1:

The key is arkit for your info.plist file under Required device capabilities.

Apple documentation on plist keys (UIRequiredDeviceCapabilities).

Key: arkit

Description: Include this key if your app requires support for ARKit on the device (that is, an iOS device with an A9 or later processor).

Minimum version: iOS 11.0

One important caveat for existing apps is that Apple does not allow you to restrict devices for an app once it has been released.

Important: All device requirement changes must be made when you submit an update to your binary. You are permitted only to expand your device requirements. Submitting an update to your binary to restrict your device requirements is not permitted. You are unable to restrict device requirements because this action will keep customers who have previously downloaded your app from running new updates.

If you are adding AR functionality to an existing application, you can use the isSupported property of ARKit to determine if you should expose this functionality.



回答2:

If your app requires ARKit framework for its core functionality, then you need to open info.plist file (located inside your project's folder in macOS Finder) and under the key UIRequiredDeviceCapabilitie add a string arkit like that:

<plist version="1.0">
  <dict>
    <key>UIRequiredDeviceCapabilities</key>
      <array>
        <string>arkit</string>
      </array>
  </dict>
</plist>

But if Augmented Reality is a secondary feature of your app, then use this lines in ViewController.swift. Here's how your code should look like:

if ARWorldTrackingConfiguration.isSupported {   
     
    let configuration = ARWorldTrackingConfiguration()             // 6DOF
    configuration.planeDetection = [.horizontal, .vertical]
    sceneView.session.run(configuration) 

} else {  

    let configuration = AROrientationTrackingConfiguration()       // 3DOF
    sceneView.session.run(configuration)  
    print("This chipset does not meet the minimum requirements.")
}

A list of ARKit 4.0 compatible iPhones is the following (A9...A13 CPUs):

  • iPhone 6s
  • iPhone SE
  • iPhone 7
  • iPhone 8
  • iPhone X
  • iPhone SE2
  • iPhone 11
  • ...and higher