iOS dialogs don't open in app, but in background - ios

After my cordova app is launched on iOS, the authorisation dialogs ("Do you want to grant access to your position?" etc.) do not appear in the app itself, but only open once the app is sent to the background and then reopened. This is obviously unreasonable for the user.
I'm having the same issue with the inAppBrowser, which only triggers once the app is reopened from the background.
Depending on the cordova CLI version I use to build, the results change for the better or worse. No error message anywhere.
Is there any plugin, setting or something else that could cause this behavior?

Answering my own question:
This happened because of a
<meta http-equiv="Content-Security-Policy">
in the head of the programm. Removing this fixed the issue and everything works like it should.

Related

What are some possible reasons that UNUserNotificationCenter.current().requestAuthorization might not prompt?

What are some possible reasons that UNUserNotificationCenter.current().requestAuthorization might not prompt?
I have some users that are not receiving the prompt for permission at all. I've even tried to change the app bundle Id in TestFlight to see if they would get the prompt but to no avail.
I've tried resetting permission via https://developer.apple.com/library/archive/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG42 as well.
Notification permission settings does not get listed within the app settings on iOS which leads me to believe it isn't necessarily rejected.
Any help would be greatly appreciated. I don't think this is a code issue as the call is fairly straightforward.
Asking for provisional permissions causes the permission prompt for notifications not to show on iOS < 12.
If the user has rejected the permission for your app before, then the dialog won't show either.
Even though the problem was caused by something silly; I think it would still be worthwhile to share the problem resolution.
We have a WK WebView iOS app. On our Angular side, we try to detect whether or not the environment is currently iOS native app before trying to prompt the user for permission. We do this detection by setting a flag in local storage (I don't really have all the details as it is not my code - I'm just the reviewer). Between the loading of the native app, the WebView and angular code, we couldn't reliably ensure that things are handled synchronously.
The detection failed - so we never prompt the user.
Thanks again for the help.

iOS universal link does not work on one device (although works on other iOS devices)

I'm facing a strange issue with universal links on iPhone - iOS 12.2.
I'm trying to open the APP using a registered universal link (the same link works on other devices using both - the same and different version of iOS), using identical application (the same version).
What's strange is that I can't even find the option to open the link in a native app when holding the link for a while on this device, although I found it in other devices.
It used to work, but then suddenly stopped to open the APP. I tried rebooting and reinstalling the app.
Did anyone face similar issue? Any suggestion in debugging? I'd really like to avoid factory reset of the phone.
You might be running into either of these two bugs:
https://openradar.appspot.com/45201697
https://openradar.appspot.com/33893852
I just ran into this. Deleting the app, reboot the device, wait an hour or so (unsure of time needed to wait) then reinstall the app. That seems to force it to re-check the AASA.
Seems like there could be a process running after reboot blocking swcd from running.
Have you tried to delete the app and restart the phone to check if this is not a apple-app-site-association problem?
So after upgrading to the newest iOS the problem still remained in Chrome.
I was able to open the contextual menu and open the app through the Open in... item from Safari, and since then it works as expected across all the browsers. This doesn't explain the origin of this issue, but I hope this will help you as well.

why does my phonegap app restart if kept in background for long

my phonegap app restarts if kept in background for long. For example if i open my app the next day it relaunches rather than starting from where i left off. Otherwise it seems to preserve state perfectly.
I see this happening for some other apps too that are installed on the iphone like instagram, twitter, but not for facebook and whatsapp. Does iOS kill apps if in background for long? Can i prevent this?
I am using Phonegap CLI 6.0.1 (cordova build version 4.0.1) testing on iOS9. Let me know if any other information is needed. Thanks!
iOS will kill apps when it needs the resources. There is nothing you can do to prevent your app from being killed (by iOS or the user). This has nothing to do with your app being made with phonegap (or anything else).
You need to code your app to handle being killed. When the user chooses to use your app again (after it happened to be killed), your app should launch right back to where it was, restoring its previous state. This is what all good apps do.

Cordova app running fine on safari, but crashing when installed as app

I've built a tool for a client, which basically is a tool that displays a number of items and filters them base on the set parameters. This tool started as a web-based project and it runs on all browsers and it should run when opening the html-file from the filebrowser(so when no server is involved).
We tested this on tablets/phones as we knew that it would needed to be ported. So this code is running fine on our ipad3(first gen retina) when we open it up on safari. Now we've been setting this up with cordova. But the moment this loads, we get memory warning, saying that the memory should be cleared etc... the app is running sluggish and some new bugs are showing, probably due to the memory issue's...
I've been looking into profiling/timelineing to find memory-leaks etc, but i can't really find any notable memory-leaks.
Another quirky thing: If we build this app in portrait mode only, the issue's dissapear. But the code that is being executed is exactly the same, we don't do anything differently when in portrait mode besides other styling.
Could be CSS/Mediaqueries/images(png's) be causing these issue's?
If anyone could point me in a direction, that would be great.
If you guys need code/examples/... shout and I will provide.
thx
I found the issue last week. Apparently this was cause by my css. The results were shown as small items in a list of approx 60 items. And they had an on-hover/touch event that would flip the item. But the css that was adding the perspective/backfacing etc was causing memory issue's. I removed them, and everything was working perfectly.
I do still however wonder why this is causing issue's in Cordova, but not in native safari, I would presume that the same app with same code on the same browser would give the same performance .... But apparently there are some differences between a webview and the native safari app?
Unless you installed a WkWebview plugin, Cordova will run your app in a UiWebview which has a lot of performance and memory issues that are not present in WkWebview.
Native safari uses WkWebview under the hood, which explains the performance and stability differences between your Cordova app and Safari.

ios 8 openUrl itms-services does not exit current app

In iOS 6 or 7, the app exit to the home screen when I call UIApplication openUrl with a url of itms-services://XXXX to install a new version of my app (using enterprise deployment with ipa files).
In iOS 8, this is no longer the case. Now the app continue running just as nothing has happened, but if I go the home screen, I can see my app icon grayed out, with a downloading pie chart about 66% completed and the text "Downloading..." below. If I now wait for a while (less than a minute), the application is installed correctly and I can start my app again.
Has anyone else experienced this behavior? Have anyone seen any documentation regarding this? I can accept behavioral changes as long as it is documented, but I haven't seen any documentation regarding this.
While forcing the app to crash will technically work, a much better solution (allowing the user to retain the state of the application) would be to simply background the app launching the itms-services link by executing the following.
[[UIApplication sharedApplication] performSelector:#selector(suspend)];
We use this in an app used for distributing test builds to our testers and it works very well, and eliminates the confusion of a tester trying to install an app and having the app stay in front. It also allows them to return to our distribution app and have it pick up where they were.
Yes, you also get the same behaviour when clicking a download link in safari now on iOS8.
I'm not sure why they introduced this change but there isn't really a way around it (unless you force your app to crash with something like exit(0);)
Also, the itms-services url scheme is undocumented and is technically a private api. From experience, you're not allowed to submit apps to the App Store that use it.
I have experienced a similar thing. I have a web page for our internal app store and when I tap on the link I do get a prompt asking if I want to install and when I say yes safari just sits there. The app is downloading on the home screen but under IOS 7 safari would be pushed to the background and you could see where your app is being downloaded to and its progress. Now it appears like nothing is happening. I would love to correct this. Perhaps something has changed in the .plist files the itms-services protocol uses. This protocol is not private it is just reserved for enterprise deployments.

Resources