summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/arkit/arkit_interface.mm19
1 files changed, 17 insertions, 2 deletions
diff --git a/modules/arkit/arkit_interface.mm b/modules/arkit/arkit_interface.mm
index 9614f775a5..71642cfc30 100644
--- a/modules/arkit/arkit_interface.mm
+++ b/modules/arkit/arkit_interface.mm
@@ -37,6 +37,8 @@
#import <ARKit/ARKit.h>
#import <UIKit/UIKit.h>
+#include <dlfcn.h>
+
#include "arkit_interface.h"
#include "arkit_session_delegate.h"
@@ -53,7 +55,10 @@ void ARKitInterface::start_session() {
// Ignore this if we're not initialized...
if (initialized) {
print_line("Starting ARKit session");
- ARWorldTrackingConfiguration *configuration = [ARWorldTrackingConfiguration new];
+
+ Class ARWorldTrackingConfigurationClass = NSClassFromString(@"ARWorldTrackingConfiguration");
+ ARWorldTrackingConfiguration *configuration = [ARWorldTrackingConfigurationClass new];
+
configuration.lightEstimationEnabled = light_estimation_is_enabled;
if (plane_detection_is_enabled) {
configuration.planeDetection = ARPlaneDetectionVertical | ARPlaneDetectionHorizontal;
@@ -221,7 +226,17 @@ bool ARKitInterface::initialize() {
print_line("initializing ARKit");
// create our ar session and delegate
- ar_session = [ARSession new];
+ Class ARSessionClass = NSClassFromString(@"ARSession");
+ if (ARSessionClass == Nil) {
+ void *arkit_handle = dlopen("/System/Library/Frameworks/ARKit.framework/ARKit", RTLD_NOW);
+ if (arkit_handle) {
+ ARSessionClass = NSClassFromString(@"ARSession");
+ } else {
+ print_line("ARKit init failed");
+ return false;
+ }
+ }
+ ar_session = [ARSessionClass new];
ar_delegate = [ARKitSessionDelegate new];
ar_delegate.arkit_interface = this;
ar_session.delegate = ar_delegate;