Start a new topic

loadARchitectWorld not calling callback - Cordova on iOs

loadARchitectWorld not calling callback - Cordova on iOs

1 person has this problem

Hi,

Thanks for your response.

It is a Cordova Project.

I used cordova plugin latest code, 7.1.2 

Test on iPad and iPhone iOS 11.

Please check my log code above:

this code is not alway called when we launch 

console.log('LoadedUrl: ', loadedURL);


Thanks,

Huy



1 person likes this

Same here. I'm using v5.0.1-3.2.0-beta.1. Neither successCallback nor errorCallback are called. Android works as expected.

Hi Julien,
This sounds very strange as this is one of the things we constantly test. Are you using our example application or your own application?

Can you send us a video showing the effect?

Best regards,

Andreas

Hi Huy,


Could you please provide further details on the issue:

  • 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?
  • please send the crash log
  • What device does this happen with (os Version and model)?
  • Is this happening with the sample app or in your own app? If it happens with your own app, does the sample app work on your device?
  • Send exact steps to reproduce this issue and a video so we can check how we can reproduce this issue

Thanks

Eva


Hi,

 

We have done more tests and we have isolate an problem.

 

we use : 

 

onUrlInvoke(url) {
app.wikitudePlugin.close();
}

 

 

Upon detection of a target we send :

document.location = "architectsdk://.....";

 

However Wikitude not close all the time. In the majority of cases it closes, but occasionally it does not close. (IOS only)

Same for " hide() ";

 

I haven't succeeded in reproducing with your sample.

For information, we use wikitude with Meteor.

 

Thanks for your help

Hi Julien,
What is Meteor?

We noticed that in case a dom manipulation is triggered, document.location changes might be ignored by the web view as it already prepares for a page reload. Do you trigger any dom changes in case a target is recognized? If that's the case, a setTimeout(300ms) around the document.location = "architectsdk://" helped for us.

Best regards,

Andreas

Hi Andreas,

 

Yes document.location changing when an target is recognized. I have tested  : 

 

setTimeout(function(){
var architectSdkUrl = "architectsdk://" + encodeURIComponent(World.targetNameCurrent);
document.location = architectSdkUrl;
}, 300);

 

But the solution not Working :/

 

You can see Meteor here : https://www.meteor.com/

 


Best regards,

Andreas

Hi,
Can you please try out our latest Cordova update which was release just a couple of days ago? We fixed the mentioned callbacks on iOS.

Best regards

Andreas

Hi,



I just tested this with our Cordova sample app on an iPhone 8 running iOS 11 and found it to be working. I used version 7.2.1 of the SDK. Have you tried this version yet?


Otherwise I'd be interested to know whether you are having this issue in your own application or our sample app. If it is the former, I'd like you to try using our sample app and checking whether the same thing happens.


We offer a script to conveniently set the sample app up. Here's the documentation page that shows how.



- Daniel


Hi everyone ,

I have the same problem as you Huy le on ios   .
but when i rotate the phone i got alert message saying ( setBackButton callback is only availble on android and not on ios ) and then the code inside the callback function is called .

and xcode log give that error :


<MainViewController: 0x10290e3a0> whose view is not in the window hierarchy!


I use cordova sdk v  7.1.2  and IOS11



Thanks 




Hi Julien,
Can you confirm that in case the Wikitude Cordova plugin is not closed, the `onUrlInvokd` callback is not called as well?

Best regards,

Andreas

Hi Andreas,

Yes I confirm.

Best regards

I'm experiencing a similar issue on iOS.

Sometimes the success callback is called - sometimes not. In the latter case the error callback is also not called.


It seems pretty random when and when not the success callback is being executed...


My code:

import React, {Component, PropTypes} from 'react';

export default class ARDemoView extends Component {
    constructor(props) {
        super(props);

        this.wikitudePlugin = cordova.require("com.wikitude.phonegap.WikitudePlugin.WikitudePlugin");

        // this.sample = {
        //     path: "http://192.168.43.4:3000/ar/samples/01_ImageTracking_1_ImageOnTarget/index.html",
        //     requiredFeatures: [
        //         "image_tracking"
        //     ],
        //     startupConfiguration: {
        //         "camera_resolution": "auto",
        //         "camera_position": "back"
        //     }
        // };

        this.sample = {
            "path": "http://192.168.0.102:3000/ar/samples/01_ImageTracking_1_ImageOnTarget/index.html",
            "requiredFeatures": [
                "image_tracking"
            ],
            "startupConfiguration": {
                "camera_resolution": "auto",
                "camera_position": "back"
            },
            "extraData": {
                "key1": "test",
                "key2": "test2"
            }
        }

        this.wikitudePlugin.isDeviceSupported(this.onDeviceSupported.bind(this), this.onDeviceNotSupported, this.sample.requiredFeatures);
    }

    onDeviceSupported() {
        console.log("DEVICE SUPPORTED!");

        this.wikitudePlugin.requestAccess(
            this.onRequestPermissionSuccessful.bind(this),
            this.onRequestPermissionError.bind(this),
            this.sample.requiredFeatures);

    }

    onDeviceNotSupported(error) {
        console.log("DEVICE NOT SUPPORTED", error);
    }

    onRequestPermissionSuccessful() {
        console.log('loadArchitectWorld', this.wikitudePlugin);
        console.log('loadArchitectWorld', this.sample.path);
        this.wikitudePlugin.loadARchitectWorld(
            this.onARExperienceLoadedSuccessful.bind(this),
            this.onARExperienceLoadError.bind(this),
            this.sample.path, this.sample.requiredFeatures, this.sample.startupConfiguration
        );
    }

    onRequestPermissionError(error) {
        /* The error object contains two error messages.
            * userDescription is a end user formatted message that can be displayed with e.g. a JS alert
            * developerDescription is a developer formatted message with more detailed information about the error
         */
        /* Here, the userDescription is used to show a confirmation box which, in case of a positive result, shows the applications settings so that user can grant access. */
        var openAppSettings = confirm(error.userDescription + '\nOpen App Settings?');
        if (openAppSettings == true) {
            this.wikitudePlugin.openAppSettings();
        }
    }

    onARExperienceLoadedSuccessful() {
        console.log("LOADED");
        const array = ["a","b", "c", 6];
        this.wikitudePlugin.callJavaScript(
            `
            AR.logger.setHTMLLoggingEnabled(true);
            World.params = {
                trackerFile: "assets/magazine.wtc",
                overlayImage: "assets/imageOne.png",
                thumb: "assets/surfer.png"
        
            }
            World.createOverlays('puta');
            AR.logger.info("overlaysCreated");
            
            `
        )
    }

    onARExperienceLoadError(error) {
        console.log("LOAD ERROR", error);
    }

    render() {
        return (
            <div>
                <p>AR View</p>
            </div>
        )
    }
};

ARDemoView
    .propTypes = {};

 


Hi Julien,
We already decided to deprecate the document.location = architectsdk:// approach with something new. This will ship later this year. Until then I'm not sure how we proceed with this. You could try to increase the timeout. Otherwise it's a web view internal issue that these location changes are not reported correctly.

Best regards,

Andreas
Login or Signup to post a comment