Touch icon with Apple web app is not working with NSB V8. It did work in an earlier version. Any suggestions?
I just tried it on a sample here. It seemed to work properly. Can you give mine a try?
Yours worked. Mine still doesn’t. Can’t see the difference.
Here’s what I did:
- New project. Add a button, save project.
- Drop a 192x192 image into the project folder.
- Set the icon property to that image.
What happens if you make a new project like that?
That works. In fact, it works without the mobile-web-app-capable line. Mine still doesn’t. I filled out nearly all the fields in the same manner. Of course, mine has 42,000 lines of code in code.js. But, can’t imagine why any of that would have an effect.
Next step is to make some test builds of your project, leaving stuff out. Make a copy of the project. Dump the 42000 lines of code. Does the problem persist? … and so on.
Well, I have two projects like this. Both fail to install an icon, although they actually run correctly. The thing is, they both work under V4 of NSB.
The problem is the content security policy. Which is strange as the icon is where everything else is and the policy allows me to read and execute in other directories on my server.
If I remove the CSP, the icon appears correctly, but those functions that access the I’net fail. Also, oddly, I now require mobile-web-app-capable again.
None of these problems occur with NSB V4 or with Androids.
CSP and Web apps are both evolving concepts. When AppStudio 4 was developed, neither was important yet.
Are you saying you do have a CSP, and removing it causes the problem?
I require a CSP to access some files on my server. But, it blocks the icon. If I remove the CSP, the icon works, but I lose access to other files. I believe it must contain img-src ‘self’ to allow a web app icon, but haven’t been able to get that to work.
To get it to work as an Apple web app under appstudio V8, I had to do the following:
- Add meta name=‘apple-mobile-web-app-capable’ content=‘yes’ / to index.html each deploy
- Add ‘unsafe-eval’ to default-src in the CSP
- Add ’ img-src *’ to the CSP
- Change one of my server HTTP response header settings in IIS
- Remove HTTPS from code accessing some files
None of this was required under appstudio V4 or for Android. Now, I have to see if this has broken the Android and older iOS versions.