Start a new topic

Wikitude iOS JavaScript Crash on detection

 Hi,

 

I am trying to integrate the Wikitude Javascript framework (version 6.0.1) in a native iOS app, composed by Swift and Objective-C classes.

 

I have successfully compiled and tested on a iPhone 6S device the SDKExamples framework. (iOs 10.2)

 

So I've integrated the framework in my project, with a very simple configuration with the assets provided '11_PluginsAPI_3_CustomCamera'  and the following code : 

 

- (void)viewDidLoad {

    [super viewDidLoad];

 

 self.architectView = [[WTArchitectView alloc] initWithFrame:self.view.bounds motionManager:nil];

 self.architectView.delegate = self;

 

    [self.architectView setLicenseKey:WIKITUDE_LICENSE_KEY];

 

    [self.view addSubview:self.architectView];

 

 self.architectWorldNavigation = [self.architectView loadArchitectWorldFromURL:[[[NSBundle mainBundle] bundleURL] URLByAppendingPathComponent:@"11_PluginsAPI_3_CustomCamera/index.html"]];

 

 // ...

 

}

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

 

 /* WTArchitectView rendering is started once the view controllers view will appear */

    [self startWikitudeSDKRendering];

}

- (void)startWikitudeSDKRendering{

 

    [self.architectView start:^(WTStartupConfiguration *configuration) {

        configuration.captureDevicePosition = AVCaptureDevicePositionBack;

 

    } completion:^(BOOL isRunning, NSError *error) {

 

    }

}

 

At runtime, the camera launches successfully, and displays preview with no problems, but when it detects the target, the app freezes and crashes on a thread with the following  callstack : 

 

 

Thread 0 name:  Dispatch queue: com.apple.main-thread

Thread 0:

0   libsystem_kernel.dylib         

0x000000018ea7d188 mach_msg_trap + 8

1   libsystem_kernel.dylib         

0x000000018ea7cff8 mach_msg + 72

2   CoreFoundation                 

0x000000018fa7a5d0 __CFRunLoopServiceMachPort + 192

3   CoreFoundation                 

0x000000018fa781ec __CFRunLoopRun + 1132

4   CoreFoundation                 

0x000000018f9a62b8 CFRunLoopRunSpecific + 444

5   GraphicsServices               

0x000000019145a198 GSEventRunModal + 180

6   UIKit                         0x00000001959ed7fc -[UIApplication _run] + 684

7   UIKit                         0x00000001959e8534 UIApplicationMain + 208

8   SAFEConsumer                   

0x000000010008fb7c main (AppDelegate.swift:16)

9   libdyld.dylib                 0x000000018e9895b8 start + 4

 

[...]

 

Thread 23 Crashed:

0   SAFEConsumer                   

0x00000001005b04ec .subsample_loop + 4

1   SAFEConsumer                   

0x0000000100540988 aramis::ImagePyramid::buildPyramid(aramis::BaseLayer<unsigned char>&, float, int, float*) + 440

2   SAFEConsumer                   

0x0000000100536a08 aramis::PatchTracker::setupTracking(aramis::BaseLayer<unsigned char>&) + 152

3   SAFEConsumer                   

0x0000000100544570 aramis::MusketIr2dService::processFrame() + 1256

4   SAFEConsumer                   

0x0000000100544c5c non-virtual thunk to aramis::MusketIr2dService::internalThreadEntry() + 32

5   SAFEConsumer                   

0x0000000100545b9c void* std::__1::__thread_proxy<std::__1::tuple<aramis::ThreadedClass::startInternalThread()::'lambda'()> >(void*) + 88

6   libsystem_pthread.dylib       0x000000018eb61850 _pthread_body + 240

7   libsystem_pthread.dylib       0x000000018eb61760 _pthread_body + 0

8   libsystem_pthread.dylib       0x000000018eb5ed94 thread_start + 4

When I use the 5.3.1 version of Wikitude available on your website, the same code does not crash. 

 

Thanks for your help on this topic.

 

Regards


Hi Laurent,

Before I write about OpenCV, let me ask you another question: You mentioned that you use the custom camera example but within the startup handler, you set the camera position to 'back'. Are you using the custom camera (frame access & rendering) or do you rely on the built in camera access? This might affects the upcoming conversation.


Best regards,

Andreas

Hi Andreas

 

I am using an input plugin in our app, so the camera is not managed by the framework.

The crash related to openCV happens in both cases (input plugin or built in camera), so I’ve posted the minimal code from the SDK sample without input plugin to reproduce the error.

 

Regards

 

Hi Laurent,

Thx for the information. I discuss your issue internally with the dev team and send you more information asap.


Best regards,

Andreas

Update: I'm using OpenCV library v3.2.0. Linking the SDK sample with this library reproduces the crash.


Regards

HI.. Laurent

I want to ask for ( NSURL *architectWorldURL ) because you are make change of it

How can i load the AR experience from my remote server.

i tried to make some change like the following:


NSURL *architectWorldURL = [[NSBundle mainBundleURLForResource:@"index" withExtension:@"html" subdirectory:@"https://s3.amazonaws.com/data.ar.tr/ar/index.html"];

    self.loadingArchitectWorldNavigation = [self.architectView loadArchitectWorldFromURL:architectWorldURL withRequiredFeatures:WTFeature_2DTracking];


But it not working.. Do you have a suggestion


Regards.

Hi,

This problem is not related to this post subject.. Could you please create a new subject ?

thanks

 

Ok thanks..

Update: after some research:
- the crash also occurs with previous SDK v5.3.1
- just linking the SDK sample app with OpenCV framework reproduces the issue: without using any OpenCV symbol in the code, the crash occurs when detecting an image target.
Can it be a conflict between two libraries used by the wikitude framework and OpenCV?
Could you tell me in which library the crash occurs refering to the backtrace providede in the first post, so taht I can try to remove it from the openCV build ?

Thanks,

Laurent.

 

Login or Signup to post a comment