Start a new topic

Problem "openInBrowser"

Hi guys!;

I have a problem when I open a  link  with  "openInBrowser" AR.context.openInBrowser("");

Please watch the video attach or

Info log error: 2017-02-06 18:21:02.780604 casahunter[7582:2057810] Warning: Attempt to present <UIImagePickerController: 0x16087b600> on <WT_SVModalWebViewController: 0x16012a000> whose view is not in the window hierarchy! (IOS).

Please give a Hand!...thanks!.

My ViewController is:

#import "ViewController.h"

#import <WikitudeSDK/WTArchitectView.h>

#import "NSURL+ParameterQuery.h"

#import <WikitudeSDK/WikitudeSDK.h>

/* Wikitude SDK debugging */

#import <WikitudeSDK/WTArchitectViewDebugDelegate.h>

@interface ViewController () <WTArchitectViewDelegate, WTArchitectViewDebugDelegate>

/* Add a strong property to the main Wikitude SDK component, the WTArchitectView */

@property (nonatomic, strong) WTArchitectView               *architectView;

/* And keep a weak property to the navigation object which represents the loading status of your Architect World */

@property (nonatomic, weak) WTNavigation                    *architectWorldNavigation;


@implementation ViewController

- (void)dealloc


    /* Remove this view controller from the default Notification Center so that it can be released properly */

    [[NSNotificationCenter defaultCenter] removeObserver:self];


- (void)viewDidLoad {

    [super viewDidLoad];






    // Do any additional setup after loading the view, typically from a nib.


    /* It might be the case that the device which is running the application does not fulfil all Wikitude SDK hardware requirements.

    To check for this and handle the situation properly, use the -isDeviceSupportedForRequiredFeatures:error class method.


    Required features specify in more detail what your Architect World intends to do. Depending on your intentions, more or less devices might be supported.

    e.g. an iPod Touch is missing some hardware components so that Geo augmented reality does not work, but 2D tracking does.


    NOTE: On iOS, an unsupported device might be an iPhone 3GS for image recognition or an iPod Touch 4th generation for Geo augmented reality.


    NSError *deviceSupportError = nil;

    if ( [WTArchitectView isDeviceSupportedForRequiredFeatures:WTFeature_2DTracking error:&deviceSupportError] ) {


        /* Standard WTArchitectView object creation and initial configuration */

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

        self.architectView.delegate = self;

        self.architectView.debugDelegate = self;


        /* Use the -setLicenseKey method to unlock all Wikitude SDK features that you bought with your license. */

        [self.architectView setLicenseKey:@"SECRET"];


        /* The Architect World can be loaded independently from the WTArchitectView rendering.


        NOTE: The architectWorldNavigation property is assigned at this point. The navigation object is valid until another Architect World is loaded.


        self.architectWorldNavigation = [self.architectView loadArchitectWorldFromURL:[[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html" subdirectory:@"ArchitectWorld"] withRequiredFeatures:WTFeature_Geo];


        /* Because the WTArchitectView does some OpenGL rendering, frame updates have to be suspended and resumend when the application changes it's active state.

        Here, UIApplication notifications are used to respond to the active state changes.


        NOTE: Since the application will resign active even when an UIAlert is shown, some special handling is implemented in the UIApplicationDidBecomeActiveNotification.


        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveApplicationWillResignActiveNotification:) name:UIApplicationWillResignActiveNotification object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveApplicationDidBecomeActiveNotification:) name:UIApplicationDidBecomeActiveNotification object:nil];


        /* Standard subview handling using Autolayout */

        [self.view addSubview:self.architectView];

        self.architectView.translatesAutoresizingMaskIntoConstraints = NO;


        NSDictionary *views = NSDictionaryOfVariableBindings(_architectView);

        [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"|[_architectView]|" options:0 metrics:nil views:views] ];

        [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_architectView]|" options:0 metrics:nil views:views] ];


    else {

        NSLog(@"This device is not supported. Show either an alert or use this class method even before presenting the view controller that manages the WTArchitectView. Error: %@", [deviceSupportError localizedDescription]);



#pragma mark - View Lifecycle

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];


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

    [self startWikitudeSDKRendering];


- (void)viewDidDisappear:(BOOL)animated {

    [super viewDidDisappear:animated];


    /* WTArchitectView rendering is stopped once the view controllers view did disappear */

    [self stopWikitudeSDKRendering];


- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.


#pragma mark - View Rotation

- (BOOL)shouldAutorotate {


    return YES;


- (UIInterfaceOrientationMask)supportedInterfaceOrientations {


    return UIInterfaceOrientationMaskAll;


#pragma mark - Layout / Rotation

/* Wikitude SDK Rotation handling


 * viewWillTransitionToSize -> iOS 8 and newer

 * willRotateToInterfaceOrientation -> iOS 7


 * Overriding both methods seems to work for all the currently supported iOS Versions

 * (7, 8, 9). The run-time version check is included nonetheless. Better safe than sorry.


- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator


    if (coordinator)


        [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)


            UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

            [self.architectView setShouldRotate:YES toInterfaceOrientation:orientation];


        } completion:^(id<UIViewControllerTransitionCoordinatorContext> context)







        UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

        [self.architectView setShouldRotate:YES toInterfaceOrientation:orientation];



    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];


- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration


    //if iOS 8.0 or greater according to

    if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedAscending) {



    [self.architectView setShouldRotate:YES toInterfaceOrientation:toInterfaceOrientation];


#pragma mark - Private Methods


Hi Christian,

I watched the video you provided but as it is not exactly clear to me what is the issue you are facing, could you please send me more details regarding what it is you are doing and what is the problem? Also, please include following information:
  • Which version of the SDK are you using?
  • Are you using the JS API?
  • Are you using any of our Extensions (Titanium, Cordova, Xamarin, Unity)? If yes, which version are you using?
  • What device does this happen with (os Version and model)?




When I open facebook site using "openInBrowser" the site is open correctly but if i want to upload a image the site is close and back to main.

5.3 SDK.


No extensions.

IOS 9-10

And log Xcode: "Info log error: 2017-02-06 18:21:02.780604 casahunter[7582:2057810] Warning: Attempt to present <UIImagePickerController: 0x16087b600> on <WT_SVModalWebViewController: 0x16012a000> whose view is not in the window hierarchy! (IOS)".

Any Solution?...



Hi Chris,

I'm afraid the problem is that our internal `openInBrowser` browser is already presented modally, preventing your second modal image picker controller presentation to fail.

Our recently released SDK 6 uses SFSafariViewController and also adds some more hooks so that you can customise the openInBrowser view controller presentation. You can implement the WTArchitectViewDelegate method `-architectView:willPresentViewController:onViewController:` (There are a couple more related method available) and change the presentation style of the presenting view controller to anything not modal presentation related. I haven't tried it but it might do the trick.

Best regards,


Hi Andreas;

Can you be more specific?...I need a hand with this please.



Hi Chris,

You could either try present a web view yourself and not use the Wikitude SDK openInBrowser functionality (don't present it modally) or specify 'true' as second parameter to openInBrowser which will open the default OS browser instead of the Wikitude SDK internal one.

Best regards,


Login or Signup to post a comment