[SOLVED] iPhone & iPad laced with security errors

iPhone & iPad stopped working due to security errors

originated from playcanvas-stable.min.js

The error means the image your are trying to use is loaded by some method that iOS considers not secure. Maybe loading from a local file system? Is this a self-hosted build? You could try to use a debug version of the engine to see the logs that make more sense and add breakpoints. If you have a small repro project, that would help as well.

Maybe relevant:

1 Like

ok. we solved this problem.

It was CORS problem. Reading off an image from a url. The following way correctly
reading an image out of a URL without a security problem in iPhone & iPad.

let loadPromises = this.myWorlds.map((world, index) => {
    var self = this;
    let imageUrl = 'IMAGE URL ADDRESS';
    return new Promise((resolve, reject) => {
        let img = new Image();
        img.crossOrigin = 'anonymous'; // Set crossOrigin for CORS
        img.onload = () => {
            // Assuming the framework allows creating a texture from an Image object
            let texture = new pc.Texture(self.app.graphicsDevice);
            WorldMenu.instance.worldImages[index] = texture;
        img.onerror = (error) => {
            console.log("can't load " + imageUrl);
            WorldMenu.instance.worldImages[index] = null;
            resolve(); // Resolve even if there's an error
        img.src = imageUrl;

// Wait for all Promises to complete
await Promise.all(loadPromises);

We are having the same problem all over again, and the upper mentioned solution is not helping at this point. Oh, well.