How do I set compatible devices to only ARKit compatible devices in Xcode?

核能气质少年 提交于 2019-12-22 04:07:38

问题


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.")
}

Hope this helps.



来源:https://stackoverflow.com/questions/46569624/how-do-i-set-compatible-devices-to-only-arkit-compatible-devices-in-xcode

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