Storing .png images in an ios app? - iphone

Im creating an iphone game that will use more than 1200 .png image files, and all the images combined together come up to the size 11mb, i was wondering whats the best way to store them, i was going to use the s3 storage by amazon, but I would love them to be apart of the app in the resources folder, so users can play offline aswell. So i wanted get any opinions in what is the best way to store images in terms of caching and optimizating .png files in use with IOS Apps. thanks

Just drag them into xcode. 11 MB is not much, apple has raised their download limit over 3G/Edge.
Once you have them inside your project, you just call them like
UIImage *myImage1 = [UIImage imageNamed:#"1.png"];
It doesn't get simpler.
If you don't put the files inside your project and have to download them, you download these into your Documents folder. You can put what ever you want in that directory, as it is only for your project and no other project has access to it

11MB isn't much these days, your app can be upto 50MB and still be available to download over cellular networks so the best solution is;
a) Don't worry about it. Put them in your resources folder.
If you are going to have lots more images, then the easiest solution is to simply download them when the app has a network connection. You can store them in the Documents folder and mark them as do not backup so that they aren't synchronised with iCloud. You could also store them in the Caches folder, but that makes them much more liable to vanish at any moment so you would need to have a slightly more complex mechanism to recognise they are no longer on disk and to pull them in afresh.

Related

Split game Into Parts

Hello I have a big game (mobile) divided into different parts is it possible to build a small version and make the user only download certain part ?like for example creating different games and he can download some
It's complicated but it's possible.
I don't write code because it would be endless work, but I give you some guidelines:
Asset bundles
Asset bundle is a way to very compress all your assets except scripts.
Basically you can think of it as zip files, which you can unzip and use whenever you want.
For example you can insert all the assets of a specific minigame, such as textures, 3D models, sprites, audio files and the rest.
When the user wants to play a minigame, you will have to unzip it.
You can also show a screen showing the upload percentage.
Firebase Storage
Asset bundles save you a lot of space, but if you need to save even more space, you can upload them to a server and the user will download the asset bundle from the server.
Obviously it will take a little longer than to recall it from memory; moreover, he will not be able to download it and then play it if he is offline.
To upload your asset bundles, I can recommend the Firebase Storage service.
You will not pay anything for a long time because you have 5gb free and in a month you can download it seems to me up to 1gb totally free.
Alternatively you can rent a normal server.
if you think my answer helped you, you can mark it as accepted. I would very much appreciate it :)

Downloading and storing locally on tvOS

I’m struggling to find any good docs/tutorials on this topic as generally TVOS development isn’t so popular and because my use case is a little niche so the questions I’m about to ask might be a bit silly but here goes:
I’m trying to build an app that will essentially be a video player (will actually be a mix of file types eventually but starting with video) that lets you navigate back and forth through videos like a slide deck.
I need to be able to download the videos and store them on the Apple TV as the actual device will be taken to my different clients’ locations and there may be no internet connection there.
The device won’t be used to install any other apps so I’m not worried about there not being enough space or TVOS clearing out downloaded files automatically to make space. I just want to know where I’m supposed to save files to!
Is there a temporary files folder or do I need to create a database or can I use coreData in some way?
Thanks,
Elliot

External Storage

I am developing an app where i have thousands of images i am reading from the sdcard. I would like to say when i deploy the app, the images are downloaded together with the app. I have been trying to find a solution to this but no help. Please help!!!
The images are used as bitmap resources for imageViews. the are too many that I can't put them in drawable because they will make the app size too big.
Right now i have manually copied them over to the storage of the device i am accessing them from there. If I want to test thye app on another device then i have to copy the images folder again to the external drive of that device. Is there a way i can include them in the solution without putting them in drwable
I would suggest to keep your images on some web server and try to download the images from here.This will avaoid coping images all the time to devices .
So here is what you can do :
1 ) Upload the images on some server .
2) Also you can have a xml which will have urls of all the image.
3) When you start your application you first fetch the XML and get the urls.
4) then using these urls you can lazy load the images in your app.
try to read and understand this concept here :
Thanks

Having to store too many image files

So I have a huge app. It is full of features, most of which require a couple images, and all of which have to be saved as part of the binary file. I worked really hard before the release to get under the 20MB threshold, to make the app more accessible to users. My release binaryt was 18.1MB.
So now, with the new iPad and its retina display, what should I do about updating all of my images for this new display. If I did include an updated copy, I would be way over the 20MB limit. Currently, I store some image files on my sever, and download/cache them as the user needs them, but im hesitant to do this with major features because I'm concerned some users may not always have internet access. And without some of those images, the app is useless.
Is there any way I can have an iPhone only install the iPhone graphics, and visa versa?
Apple has since raised the limit for all devices to 50 MB due to the release of the new iPad. This should hopefully allow you to fit all of the pictures in your app bundle.
One approach to minimize the size of your files is by compressing your PNG files. This will only minimize the size, and the images will continue to work correctly.
The links provided below will help you find a crusher you desire.
PNG Crush
PNG Compressor
ImageOptim

iPhone/Android - securing images downloaded by app

I know there are a lot of posts about storing images on disk, both for Android and iPhone. What I would like to know is how to hide these files from user (disable access from both device itself and PC sd-card reader).
I want my app to download copyrighted images that should be only accessed using my application.
Android & iPhone,
multiple images (I'm guessing around 50-200, maybe more)
image size +/- 150-300 KB, various size but less than 1000x1000.
You can encrypt the downloaded bytes and then save it with any of your own format file extension. Then save it on your disk. While Reading Decrypt the data and use it accordingly.
This the only way i think to implement this. Hope it helps :)
SD cards are FAT formatted, i.e. all content is available to all. Your only real option is encryption. You can probably adapt the code here to encrypt and decrypt a file: http://www.androidsnippets.org/snippets/39/
Obviously you'd have your app generate a random key on first run, and store it in your preferences (which is private to your app on internal storage).