Hi,
i switched my old app to WKWebView and got i white screen.
So i made a new simple app to test the new WKWebView.
When i run the app in a browser, all is fine, the json schema gets loaded.
If i run the app from my iphone, nothing happens…
On the server i send the header: **Access-Control-Allow-Origin: ***
The home.ts file:
import { Component, OnInit } from '@angular/core';
import { NavController } from 'ionic-angular';
import $RefParser from 'json-schema-ref-parser';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage implements OnInit {
public schema: Object;
constructor(public navCtrl: NavController) {}
public getFlatSchema(uri: string): Promise<Object> {
let parser = new $RefParser();
return parser.dereference(uri);
}
ngOnInit() {
this.getFlatSchema("https://v22017084844652188.powersrv.de/schemas/test.json")
.then((value) => {
console.log("Schema fetched...");
this.schema = value;
})
.catch(error => {
console.log("Schema not fetched...");
console.log(error);
});
}
}
I’m getting the following error:
Schema not fetched...
2017-11-04 17:45:13.077679+0100 MyApp[1910:333737] {"line":33786,"column":29,"sourceURL":"http://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/vendor.js","__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0},"name":"Error","message":"Error downloading https://v22017084844652188.powersrv.de/schemas/test.json \nType error","stack":"http://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/vendor.js:128504:19\nonInvoke@http://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/vendor.js:4247:39\nrun@http://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/polyfills.js:3:9529\nhttp://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/polyfills.js:3:19625\nonInvokeTask@http://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/vendor.js:4238:43\nrunTask@http://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/polyfills.js:3:10224\no@http://localhost:8080/var/containers/Bundle/Application/5F2507A6-B675-4269-95FC-398B8E58AE54/MyApp.app/www/build/polyfills.js:3:7281\npromiseReactionJob@[native code]"}
I made a simple test app. You can access the repository here.
So, what do I wrong?