4

I'm using ARKit but it is not a core functionality in my app, so I'm not setting the arkit key in the UIRequiredDeviceCapabilities. I'm setting the directive @available(iOS 11.0, *), but ARKit requires an A9 processor or above (that is, iPhone 6S or newer...)

What the best way to check that? I've found a workaround that involves checking the device model in several places, but it looks like it's a bit complicated. And would this be rejected in a review for the Store?

Tamás Sengel
  • 47,657
  • 24
  • 144
  • 178
AppsDev
  • 11,441
  • 20
  • 81
  • 163

2 Answers2

8

You should check the isSupported boolean provided by the ARConfiguration class for this.

From the Apple Developer Documentation:

isSupported

A Boolean value indicating whether the current device supports this session configuration class.

All ARKit configurations require an iOS device with an A9 or later processor. If your app otherwise supports other devices and offers augmented reality as a secondary feature, use this property to determine whether to offer AR-based features to the user.

Community
  • 1
  • 1
Tamás Sengel
  • 47,657
  • 24
  • 144
  • 178
  • Thanks, but the thing is that I'd like to check before showing the view controller that handles AR... – AppsDev Oct 09 '17 at 09:06
  • 1
    You don’t even need an instance — `isSupported` is a class property, and the class always exists in iOS 11 regardless of whether you can do anything useful wth an instance. Just `if ARWorldTrackingConfiguration.isSupported { ... }` is all you need to gate functionality before showing an AR view. – rickster Oct 09 '17 at 19:54
2

Just check ARConfiguration availability.

if (ARConfiguration.isSupported) {

      // Great! let have experience of ARKIT
} else {
     // Sorry! you don't have ARKIT support in your device
}
Prabakaran
  • 550
  • 1
  • 5
  • 8
  • FYI, in iOS 11.0.x, whenever calling ARConfiguration.isSupported method, it took 0.001~0.005 seconds. It would be better manage with cache for a lot of calling this method. – Dongjin Suh Mar 19 '18 at 08:42