App Size and dynamically downloading resources - ios

My application that will be posted soon is going to dynamically download images and resources that have to do with art when something is unlocked in the app. This will keep down on app size and the app will only download resources when it is needed. Very similarly to Droid development since they cap at 50mb sizes.
Does anyone know if this could potentially harm the approval process to apple? The expansions that will be downloaded could be around 30mb and could be very slow if the user decides to do this on data. Any advice or prior issues with apple on some type of process like this would be very helpful.
Thanks in advance.

You should be good. I have an app that downloads every new XKCD webcomic when it is released. Each being an image, this has added considerable size to the app.
To play it safe, I would suggest including something in the app description (within the app and on the iTunes store) that tells users the app dynamically downloads content. There is no rule against it, but letting the user know is always good.

Related

iOS On-Demand Resources - Download Only On Demand. Debuging

I'm using on demand resources for several videos in my app. I have tagged the resources, and put them in the "download only on demand" tag, in the Targets Resource Tags. I download the resources using NSBundleResourceRequest, and it all works great. When I execute the code, the resources get downloaded, and I can see this in the disk section in xcode.
I don't think I need to post my code, for my question.
My question is, when I run the app from xcode on my device, I see that xcode runs the app, and copies the videos to the app right away, even before I execute the download code. Also, if I check my app in the settings, iPhone storage, I see the app is taking up a lot of space since the videos are already downloaded. Why are the videos already taking up storage before they are "downloaded"?
Is this happening only because I am debugging the app, but when I publish the app, the videos will only be downloaded when the user executes the download code?
It seems a basic question, but I cannot see anyone who address this point/
Thanks
Is this happening only because I am debugging the app, but when I publish the app, the videos will only be downloaded when the user executes the download code?
Yes. The Simulator is not a real device and Xcode is not a server. Your access to the resources is correctly simulated — they are nil until you ask to begin accessing them, and then they start working — so you are able to test, which is all that matters. But to get the real experience you should run thru TestFlight on a device. See https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/TestingPerformance.html for more about that.

iOS reducing size of binary in App Store update

I have an application that is currently in the App Store.
It has approximately 500mb of data that it needs in order to run.
I was fighting and fighting various methods to install this data after the app was downloaded, including AFNetworking and WhiteRaccoon, to no avail... the deadline was coming fast, so I decided to just ahem bundle the content into the App Bundle, and worry about it later. This meant the size of the app dictated that people downloaded it while on WiFi, but ... whatever.
Now, I have discovered NSURLSession, much to my delight, and it does everything that I need that I couldn't make the others do (see my answer to this question).
So... I am ready to push a new update to the App Store, and my Archive size has been reduced from 491.2mb to 32.2mb (!!?woohoo?!!).
I am curious how Apple manages this. I have read this document that mentions techniques that they use to keep the app bundle size down by detecting what hasn't changed, but it doesn't explicitly mention anything about the scenario that I am facing.
Now, if 460mb or so of obsolete bundle/code is going to be stored in the user's device, I'd like to be able to recommend to them that they delete the app entirely and reinstall... but I am curious if I/they need to do this, or does anyone know how Apple will handle this scenario ?
Thanks.
That document you reference, Technical Q&A QA1779: Reducing Download Size for iOS App Updates, covers what Apple does to optimize the size of the app update. But the net effect is the same as if the app bundle on the user's device was entirely replaced. As that document says:
In addition to new content, the update package contains instructions on how to transform the prior version of the app into the new version of the app. New files will be added, modified files will be replaced with their updated counterpart, and deleted files will be removed as part of this transformation. As far as the developer and user are concerned, this process is entirely transparent and the resulting updated app will be indistinguishable from a full download of the corresponding updated version of their app.
So, no, you don't have to tell users to delete the old app unless there's anything in persistent storage (Documents, NSUserDefaults, etc.), that need to be reset. And you should probably handle that programmatically, anyway.

iOS deleting all app sandbox data automatically

I have a very strange issue that has been occurring to a few users of my app. One of the users actually described the issue to me.
My app downloads magazine data to the device to allow for offline reading. This means that users can sometimes have around 10 gigs+ downloaded to the device.
The problem this user experienced (and a few others have too) is that randomly all sandbox data gets deleted from the app (included core data files). The user told me that he was downloading something in a different app and got the "Storage Almost Full - You can manage your storage in Settings" popup message.
He went to the settings app and went to General > Usage. He then saw the app was using around 13 gigs of data. While he was in that list he said every time he went out of the Usage tab, then back in the app's data was getting smaller and smaller. Until eventually the app said it was using 0mb.
When he logged back into the app all his data was deleted and core data was also removed which lead the app to think he was a completely new user with no data downloaded.
I then ran some tests on my own where I made sure my device only had 100mb of space available. I then started downloading in the app. The warning message popped up alerting me I was running out of space and I ignored it and continued downloading. I have now downloaded about 1.5 gigs of data and am still downloading and the device seems like it is freeing up space somewhere else to make room for my downloads.
I've searched far and wide and have found no one else ever experiencing a problem like this. So my questions are:
Has anyone else every experienced this issue before?
Does Apple have a policy that will remove app data from the app that uses the most space if the device is running out of space?
Is there an algorythm that decides which app will get cleared when space is running out?
Is there a way to tell the OS not to remove data when running out of space?
Any help would be appreciated!
Assuming you're storing the data in the caches subdirectory:
On iOS 5.0 and later, the system may delete the Caches directory on
rare occasions when the system is very low on disk space. This will
never occur while an app is running. However, you should be aware that
iTunes restore is not necessarily the only condition under which the
Caches directory can be erased.
Documentation here

Installed App Sizes Vs Appstore app sizes

Here is a question that had been bothering me. The other day I checked my wife's phone and pinterest app was eating up 2 GB of space while the actual app in the appstore is 26.8 MB. I know there must be user / log / crash data that is dumped in its apps document directory but that got me thinking how many other apps on her phone had large amount of user data stored compared to what the app size is in appstore.
So here are my questions of how to do all this using objectiveC
Sample Xcode iHasApp display's all the available apps installed on a device. Is there a way I check how much space they are taking in GB/MB etc?
Is there a way I can go query that app build size in appstore and tell the user hey its only X MB in appstore?
I know I can get to all the app installed on a device is there a way I can check when was an app last launched or used by a user?
Can I check how much space photo / video and music is taking up?
What I am trying do in the end is to see if I can make an app that shows user what they got installed on their device and make some informed decisions themselves.
So far all I am able to find is how to check total used and free space on a device and get a list of all apps installed.
Sample Xcode iHasApp display's all the available apps installed on a device. Is there a way I check how much space they are taking in GB/MB etc?
No. The APIs being used by iHasApp can only be used to check whether selected applications are present -- basically, all you get to ask "is ThisApp installed?", and you can build up a partial list of installed applications by running that check for a large number of common applications.
There is no way to get launch or disk usage information for other applications. I'm not sure last launch is even tracked at all by the device.
With this in mind, most of your other questions are irrelevant. It is not possible to do what you're after from an iOS application.

Know whether user downloaded iOS app for free or paid?

I am switching my iOS app which is already on the app store from paid to free. I want to know which users have paid for the app, so I can treat them differently (like not showing them additional ads). As far as I know, there's no way to get which version of the app users originally downloaded.
One thing I thought of is this. I can release an update at the same time the app goes free. Everyone who launches the game for the first time who has the update gets marked with a "Free Download" flag. The issue here is what if someone paid for the app, then didn't launch it, then updated their app. That means I will treat them like a free user even though they have paid. Thanks!
There's no way to do this with 100% accuracy without releasing a new app.
If you do use a flag of some sort, save the flag in the keychain and/or iCloud so that it will have a better chance of persisting across uninstall/reinstalls and from device to device (if you use iCloud).
Your best bet though is probably to release a new lite version of the app. It can be a pain to maintain two versions, but at least you know for sure who's paid and who hasn't.
I somewhat accomplish this with a server-side script. On initial app launch, I grab data from my server to determine if this is a paid or free install and then save this info in iCloud. It works relatively well, but it does have a drawback; a small percentage of the time the query fails. If it fails, I just set the app as being paid so as not to screw anyone over. This screws me over a bit, but I take the hit for the convenience of not having to update whenever I want to switch paid/free.
You cannot show updates or advertisement for the customers separately who bought the app for free or by paying money. Whenever you changed your paid app to free, the customers can download the application for free now.

Resources