iphone offline cached apps dissapear after closed in safari? - iphone

We're developing an html5 offline webapp for the ipod touch/iphone. We have the manifests and everything working correctly, but we can't figure out why our app will not reopen after the 'tab' in iphone safari is closed.
For example's sake, here's what works:
1) open the url to the offline-enabled html file in safari on the ipod touch
2) exit safari, turn wifi off
3) go back into safari where the dynamic webapp is in a window, hit refresh
4) app works offline!
however, if we do this, the offline app dissapears:
5) add a bookmark to the app's url (or a home screen icon)
6) close the 'tab' or window in safari
7) open the bookmark or the home screen icon
8) error message: "Cannot Open Page: Safari cannot open page because it is not connected to the internet."
I've googled on the issue a bit, and you know how it goes, I'll find the answer 2 seconds after hitting 'post' here.. but anyway my gut feeling is that the current latest iphone OS version of safari is trying to dns lookup on the url and erroring out rather than realizing it has the locally stored app already on the device.
anyone run into this? is there some flag i can set in my manifest or something to fix this?

You probably do not have your server properly configured. The Apple docs do not make this clear.
If your server is running Apache (most likely), you need to edit this file: /user/local/apache2/conf/mime.types
Add this line to the end:
text/cache-manifest manifest
You will need to restart Apache so the settings take effect. Could be something like
restart_apache from the shell.
What's happening here is that the server needs to return the cache file back to you with the proper content type set. If you don't do this, the file will probably come back as 'text'. If set properly, it will come back with a type of 'cache-manifest'.
To test what mime type a document is being returned as, use web-sniffer.net. Enter the url to your manifest file - you will see the result displayed in Content-Type:

Tip: Check that whenever you make changes to the files in the manifest that you change something in the manifest itself to indicate that those files need to be downloaded. And watch out for cached files that might not be checked for changes based on their expiration settings

It seems Safari (and thus the iPhone) expects all files to be listed in the manifest - even the main file of the app. I was using default.asp as the main page of my app and not including this in the manifest. My app was run from mydomain.com/myapp/ and thus the browser never saw the "default.asp". Also, according to the HTML5 spec, the main page need not be in the manifest but apparently Safari sees that a little differently.
My solution was to avoid using default.asp and calling my app app.asp and adding "app.asp" to the manifest. Hope this helps.

Related

Firebase Dynamic Links No Longer Open App

I am working on an app that uses Firebase dynamic links. All throughout testing, the base link, and deep links would open the app, as expected.
At some point, this stopped working on my test device. I tried turning the Associated Domains off and back on again (format is applinks:myappid.app.goo.gl). My URL Types setup in Info has the URL scheme set to my app's bundle id, which is also reflected in Firebase. My AASA still has the expected info in it as well.
I also tried long pressing on the link in both notes and messages (don't get an option to open in app, just open), but it still refuses to work. Oddly enough, it still works in simulator. Any help would be appreciated.
Update: I uploaded the build to TestFlight, and it works properly there. It looks like the issue only occurs on a physical test device, with the app being built from XCode.
Solution Update: Oddly enough after installing a dynamic links build via TestFlight, subsequent XCode test run builds started working properly again. Not the most elegant solution, but at least it is working now.
Update:
This most likely has to do with an open issue that prevents the AASA file from being updated or installed. Currently the only work around is to delete the app, reboot the device, and reinstall.
http://www.openradar.me/radar?id=4999496467480576

Blackberry - App does not launch after signature

Am facing an unusual problem on blackberry, after i have signed my app with the 3 keys and say "load onto device" via Eclipse Java Plugin for Blackberry - the app loads successfully on the device, but when i click on it to launch it - does not open up, nor even a error or a dialog pops up. Please Help - Cant find a solution for this!
I have often had this issue using the 9800 device. After loading apps to the device it starts "not launching". If you go to options -> application manager -> your app's permissions you might see some permissions as custom. Setting these to "allow" fixes it. After a while it stopped launching even when allowed, deleting the app and letting the device reboot fixes it.
This is my personal experience, I don't know what the official bug/fix is
Implement logging in your application. Log every step on the application startup and write log to a text file, located on device SD Card.
When your application has been installed and you have tried to launch it, check this text file to find out, what is going wrong with your application.
Also there is internal logging mechanism, you may employ it, instead of logging to text file.
From my point of view internal log is more suitable for simple logging purposes. If you want complex logging, then text file located on SDCard is preferred.
Try to start the app, then check the device event log. To open the event log viewer, hold 'Alt' and then press L,G,L,G. You will likely see an error explaining the problem in the event log viewer.

Adding a NETWORK section to HTML5 manifest file and accessing iPhone web-app in airplane mode

The facts
I'm building an HTML 5 responsive website with an offline mode. To do that, I'm using a manifest file with a FALLBACK section and the browser's localStorage to store the pages that the users decide to save for offline access.
Everything is working great both on desktop or iPhone (haven't tested it on Android yet), except when I add a NETWORK section to the manifest file.
Why do I need the NETWORK section ? I need it for Google Analytics to work - otherwise my website's users won't get tracked, even if the user if online (that's how HTML5 applicationCache works). So this really is mandatory.
On the desktop, this is not an issue, I can turn off the Internet connection and the website works in offline mode.
On the iPhone, however, if i'm turning off the Internet connection (for instance turning on airplane mode) I'm not able to start the web-app (meaning my website added to the home screen) once the NETWORK section is added to the manifest : i'm prompted by iOS to turn on the Internet connection, and the app is closing. If there's no NETWORK section in the manifest file, everything runs fine.
My question
is twofold :
1) while I can understand that there is some logic behind such behaviour, it seems very strange (well, almost unbelievable) to me that you can't have an iOS web-app working in offline mode if there is the slightest attempt to access the network - I've read numerous tutorials about applicationCache on iOS and no one ever mention the NETWORK section's incompatibility with airplane mode.
So, does anyone can confirm (or infirm) what I'm experiencing ?
2) If there is indeed such incompatibility, the only workaround I can imagine is having a dynamically build manifest file server-side, adding a NETWORK section for desktop users only - but that means forgetting about tracking mobile online users, which is not acceptable.
So, does anyone have a better idea ?
Oops, I should have looked better on SO : this has already been answered here :
https://stackoverflow.com/a/6285955/2251905
Following the steps outlined in the abover answer solved the problem.
This has nothing to do with the NETWORK section (thankfully and rightfully !), but with what seems to be an annoying iOS bug on the iPhone.

iPhone's Safari: why geolocation prompt appears twice?

Consider the following iPhone scenario:
Select Settings->General->Reset->Reset Location & Privacy (just to ensure all warnings are cleared as a preparation to this test)
Open Safari and point to http://maps.google.com
Select OK when ["Safari" would like to use your current location] message appears.
Select OK again when ["https://maps.google.com" would like to use your current location] message appears right after.
So far so good. Now scroll up so you can see the URL box of Safari, and select the reload button (the rounded arrow next to the URL). This will resubmit the form and will cause the message on step 4 to appear again! (at least on my iOS 6, iPhone 5 device)
Any idea why message appears again after I already confirmed "https://maps.google.com" to use my current location? Is this a known issue?
I encountered this issue in my iPhone based app using UIWebView so I decided to check the same scenario using the built-in Safari app. I was very surprised to find out that this happens with Safari app as well...
Any help will be most appreciated.
I believe it's because of 2 different types of geo location firing. First you have the native w3c with the safari request and then the Phonegap call from within the browser. I'm having the same issue.
My problem is that he geolocation in google maps will only once after resetting the location and privacy settings. Figured out that google has set some restrictions in the fine print. Exploring some open source mappi g options right now (Openstreetmap) which will accept my google kml files.

iphone offline web app cache does not function

I am developing an offline web app for iphone. I have created the application and tested, it works fine apart of one feature, it is not being cached.
I have created the manifest file, and I checked with fiddler whether the right mime type comes in, and everything seems to be fine, when I shut down my data and wireless network connection, the application fails to open.
Does anyone has a clue for this problem?
Thanks
Arian
In order to cache a web app using manifest file, the browser must be able to get all files listed in the manifest file.
Although I made sure that each file can be located from the browser, there was one missing part. The browser was looking for favicon.ico file, although it was not specified in the manifest file, and as it was not found in the directory, the application was not cached.
Immediately after putting favicon.ico file in the directory, the application started to be cached and work offline.
There is a cache limit that you might be hitting. I believe it's around 5mb, but I'm not 100% certain.
Take a look at: http://www.thecssninja.com/javascript/how-to-create-offline-webapps-on-the-iphone
also:
Max size iPad / iPhone Offline Application Cache
and:
http://techblog.viewbook.com/2011/02/mobile-safari-offline-application-cache-limit/
That said, it appears that iOS 4 allows you to store more.