Start a new topic

Failed to reopen wikitude after close world

Failed to reopen wikitude after close world


Hi,i m unable to start wikitude after first time. The error throws me as below : Wikitude SDK Detected Multiple SDK Allocations.

My scenario : Open wikitude camera with success and click close to quit wikitude world but there is an error throw if reopen wikitude again.





2016-04-28 14:43:00.608 CPBVOCA === CDVPlugn Camera ===

2016-04-28 14:43:00.610 CPBVOCA === Device Supported ===

2016-04-28 14:43:00.610 CPBVOCA (null)

2016-04-28 14:43:00.610 CPBVOCA self.arViewController : (null)

2016-04-28 14:43:00.612 CPBVOCA 

 

2016-04-28 14:43:00.612 CPBVOCA  

2016-04-28 14:43:00.612 CPBVOCA ----------------- Wikitude SDK DETECTED MULTIPLE SDK ALLOCATIONS -----------------

2016-04-28 14:43:00.613 CPBVOCA A second object of type WTArchitectView was created while the previous one was not deallocated.

2016-04-28 14:43:00.613 CPBVOCA If this behaviour was not intended (multiple architect views at the same time), The WTArchitectView didn't got a call to dealloc.

2016-04-28 14:43:00.613 CPBVOCA There might be a strong reference to a WTArchitectView objects captured in a block, e.g. in a NSNotificationCenter -addObserverForName:object:queue:usingBlock: method call.

2016-04-28 14:43:00.614 CPBVOCA To disable this check (including the call to abort()), simply set the environment variable 'WTSDKDisableDeallocValidation' to YES.

2016-04-28 14:43:00.614 CPBVOCA ----------------------------------------------------------------------------------

2016-04-28 14:43:00.614 CPBVOCA 

 

(lldb)





 

This is how i open wikitude camera:





- (void) launchCamera:(CDVInvokedUrlCommand *)command

{

    NSLog(@"=== CDVPlugn Camera ===");

    CDVPluginResult* pluginResult = nil;

    NSError *isDeviceSupportedError = nil;

    

    if ()

    {

        NSLog(@"=== Device Supported ===");

        NSLog(@"%@", _arViewController);

        if (!_arViewController)

        {

            NSLog(@"self.arViewController : %@", self.arViewController);

            self.arViewController = ;

            

            ;

            

            self.arViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

            self.arViewController.architectDelegate = self;

        }

        

        ;

        

        ;

        

        

        NSURL *architectWorldURL = ;

        

        if ( architectWorldURL )

        {

            ;

            

            /*if( &&

               != kCLAuthorizationStatusDenied)

            {

                NSLog(@"Location Service enabled");

                

                locationManager = ;

                locationManager.delegate = self;

                locationManager.desiredAccuracy = kCLLocationAccuracyBest;

                

                if () {

                    ;

                }

                

                ;

            }*/

            

            self.loadArchitectWorldCallbackId = command.callbackId;

            self.urlInvokedCallbackId = command.callbackId;

            pluginResult = ;

            ;

        }

        else

        {

            self.loadArchitectWorldCallbackId = nil;

            pluginResult = ;

            ;

        }

        

        NSLog(@"%@", command.callbackId);

        

        //__weak WTWikitudePlugin *weakSelf = self;

        ;

    } else {

        NSLog(@"Not device supported");

    }

}





 

This is how stop camera world :





- (void)closeCamera:(CDVInvokedUrlCommand *)command

{

    CDVPluginResult* pluginResult = nil;

    

    NSLog(@"Close Wikitude Camera");

    if (self.arViewController)

    {

        ;

        

        ;

        

        ;

        

        pluginResult = ;

    }

    else

    {

        pluginResult = ;

    }

    

    

    if (command) {

        ;

    }

}





 

Hi Jeffrey,
Can you make sure that your WTARchitectViewController is deallocated and also your WTArchitectView member inside that view controller (add some log messages into the -dealloc method) goes actually out of scope.

Optionally you can also set the WTSDKDisableDeallocValidation environment variable to YES.

Best regards

Andreas

Hi Andreas,

I realized there is self.arViewController = nil; in close wikitude method to deallocted the view and it's works but there is some error when reopen the camera. 

WTARViewController.m - there is error when , it throws me this view haven't dealloc nicely.





- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil motionManager:(CMMotionManager *)motionManagerOrNil

{

    self = ;

    if (self) {

        // Custom initialization

        self.architectView = ;

        self.architectView.delegate = self;

        self.architectView.debugDelegate = self;

        

        ;

        ;

    }

    

    return self;

}





 

Btw, where can set WTSDKDisableDeallocValidation in my project? I cannot found this variable as well.

Hi Jeffrey,
Try to set self.architectView = nil in -deallow of yout WTArchitectViewController and/or remove it from it's superview.

 

WTSDKDisableDeallocValidation is a environment variable, so use setenv(WTSDKDisableDeallocValidation, "true", 1) to define it anywhere in your code but before the WTArchitectView is created.

Best regards

Andreas

Hi Andreas,

I tried your suggestion and it able to open Architect World but will black screen without camera prompted.I also did set self.architectView = nil in my WTARViewController.m when dealloc but seems this code never trigger because the log inside doesn't printed.

Hi Jeffrey,
Seems like you first need to figure out why your WTARViewController get's not deallocated.

Is there any particular reason why you implement your own augmented reality plugin and dont' use our existing one?

Best regards

Andreas

Hi Andreas,

I am copied whole Cordova Plugin from https://github.com/Wikitude/wikitude-cordova-plugin and implement into my project but i delete some unused function from WTWikitudeplugin.m because i only use open and close function but seems "CLOSE" function doesn't trigger WTARViewController to dealloc the view yet.
Login or Signup to post a comment