Storing and using images in my app to Parse - ios

I recently uploaded my iOS quiz app to the Apple's app store but the file size is fairly large (150 MB) and would like to reduce this size drastically. I believe the majority of the file size is coming from my images, I have over 500 jpg images in my app. I recently incorporated Parse into my app in hopes of storing the files there. Problem is, I am having some difficulty figuring out how to store and use the images from my app to Parse. The basic setup of my App is like this:
I have two folders containing all the jpg images for my app. They are saved to my project in the folders named "Newschool" and "Oldschool"
I then have two .plist files which contain all the questions and answers for my app.
Here is an example of one of the question and answer from the Oldschool.plist:
The user is shown the jpg image "PervisEllison.jpg" which is stored in the "Oldschool" folder.
So what would I need to do to move all my images from my App to Parse and code it so my App draws the image from Parse instead of the jpgs in the folders? I'm sure I need to change some coding but don't know what. I played around a little bit in Parse by adding rows and columns but have no clue what I'm dong..
I apologize ahead of time for my ignorance as I am still learning programming and know nothing of Backend as a service. Thank you!

Related

Best practice for storing and updating images in Xcode project

I am building my flash card iOS app for reviewing my learning Japanese using SwiftUI language.
The problem is how to storing and updating my images(>500 images). Please help me, any suggestion is appreciated, thanks for reading my post.
I think you're asking about how to manage 500+ images in an Xcode project. You could just add all the images to your project and load them as you would any image. You could use asset catalogs, which have the advantage that they let you store different versions of a resource for use on different devices, and only the ones needed for the device the app runs on will actually be installed on the device. See How Many Images Can/Should you Store in xcassets in Xcode? and Asset Catalog Format Reference for more information about asset catalogs. But any way you slice it, managing 500+ images is going to be cumbersome. There's probably a better way...
Managing all those images in your app isn't just a problem for you as the developer; building them into the app will also create problems for the user. Even if each image is relatively small, having hundreds of them in the app will probably make the app huge. That means it'll take a long time to install, and the app will use a lot of storage on the device. Every time you release a new version of the app, with more words, or even just to fix a few small bugs, the user will have to download all that data all over again.
Instead, you should consider building an app that can fetch the data it needs from a server. Ideally, you could apply that approach to all your app's data, not just the images. Maybe you'll organize your flash cards into sets of a few dozen, so that you can fetch a set of cards and the associated images pretty quickly, and sets that the user hasn't used for a while can be removed to free up space on the device. You'll be able to update a set of flash cards without having to update the app, and when you do update the app your users won't have to download all the data all over again.
You've said that you're a beginner, so this approach might seems very difficult. That's OK, you can start with a simpler approach and then improve as you go along. For example, you might just put all the images on a server and fetch them one at a time as you need them. Your flash card data file could contain just a dictionary with words and the URLs associated with those words. There are lots of examples of loading an image from an URL here on SO and elsewhere, so I'm not going to provide code for that, but it won't be hard to find. The earlier you start thinking about how to design your app so that it can scale as you add more and more words, the easier it will be to maintain the app later.
500 images can have a huge size. Applications that published on Appstore have size limit and Apple does not recommend to make big apps.
Store them on server and load needed images on fly. Also you will get possibility to update your images, remove add new.
If you don't have a backend, you can use something easy and free (Firebase storage for example) or with minimal code writing on AWS.
If you need to keep them on device - store them as files in the Documents or another apps folder, do not use CoreData for it (you can keep only the list of names/urls in database).
After loading image to be displayed for user, you can prefetch next bunch of images.
Use Alamofire, or SDWebImage to load images from network (I prefer last). These frameworks can do many useful things with images.
To load images:
you can have a list of your images (just list of the names and urls)
or
you can know only path and names pattern and generate links dynamically (like https://myserver/imageXXX.png.

What are some options for handling image uploading/compression in ASP?

please bear with me as I'm not trying to frustrate anyone with inane questions, and I did google search this but I couldn't really find anything recent or helpful.
I am a novice programmer and I am using a classic asp web application. I just enabled the users to upload and download images, but I'm quickly regretting it as it's eating up all of the router bandwidth. I am finding my solution inadequate, so I wanted to start over.
My desire is threefold with this functionality:
Compression. I understand that this is impossible to do BEFORE uploading without some kind of Java/Silverlight/Flash portion of the application to handle uploads, correct? What is the common way most places go about this? Just allow regular file uploads and compress once they are on the server?
Resizing. I want to resize all images before they are uploaded to a reasonable size, instead of just telling users that try and upload huge camera images that they can't upload. I figure I just want to let them upload and have it resize for them before uploading. Does this functionality exist already?
Changing filetype. I want to allow users to upload all image file types but make them .jpg on the server after the upload.
With these three requirements, how hard is it to implement something like this in just pure code and libraries? Would it be better to just use a 3rd party plugin, such as ASPjpeg or ASPupload? Have you encountered something similar, and what was your solution?
Thanks.
Take a look at ASPJpeg and ASPUpload from Persits. We use these components to upload a full size image (can be png even though the library is "ASPJpeg"), resize it to several different sizes we need on our site, then store the resized images on the server in a variety of folders. The ASPUpload component is a little tricky but if you follow their sample code you'll be fine.
I never found a good component for decompressing uploaded zip files and had to write my own, which I've since abandoned. In the end with upload speeds increasing and storage getting so cheap, it started to matter less and less that the files were compressed before being uploaded.
EDIT: Just noticed you mentioned these components in your question. Consider this an endorsement of your idea to use them. :-)

iOS App Backend Provider

I've recently submitted my iOS Quiz app to Apple but noticed that the file size for the app is pretty big (about 150 MB). Users would need to be connected to wifi in order to download it per Apple's rules. My quiz app is set up so users are given 4 choices and shown an image and must guess the correct answer from the image shown to them. How would I minimize the file size for my app so that it isn't so large? Is there a way I can host the images on a server without losing the functionality of my app? I heard of something like Backend Services but know nothing about it. If anyone can guide me in the right direction that would be awesome, thanks!
You can check out a free back end service like Parse, it could do the trick for you, especially because you dont have a lot (besides images I guess) that'll be on the server side.
This also helped me start with using it.
Good luck :)
I'm assuming you have all the quiz data (questions and images) within your app bundle?
You can shrink it next to nothing if you move all your questions and images to a backend server and serve the questions and images (links) using simple JSON Structure.
You can build your own backend (Java/PHP/etc..) or look into using Parse.
use JPEG images whenever possible. PNGs costs more space. Do not place jpeg to xcassets, since they will be converted to PNGs. If your pictures should be transparent - it is better to use Webp or JPNG format.
You may use CloudKit to host your data in a public database. You won't need any backend knowledge to do that. This tutorial will help you understand the basics. WWDC videos covers some more, i suggest you to look at WWDC 2014, Introducing CloudKit and WWDC 2015, CloudKit Tips and Tricks.

iOS Is it acceptable storing hundreds of photos in Core Data?

I am developing a simple photo editing app. I would like a journal feature for the user to view each of the photos they've edited. Some power user might have hundreds (or potentially thousands) of photos.
I am using Core Data to save photos. My concern is that hundreds of 640x640 photos might make the documents directory filesize rather large (side question: My assumption is my core data store is saved to my apps Documents directory. Is that true?).
Is it a problem to store so many photos locally within the app or am I being overly cautious? Is there a filesize limit on how much I can store?
There is no limit for storing data in the documents directory (supposing you're using documents for data and core data for paths). There was a discussion on that in this question. Other than that, you'll be fine, working with data from documents directory is rather fast by default.
The thing is - will your users be happy with your app getting bigger and bigger? Can you perhaps give them the option to store the pictures on the server and let them set the cache size?
OR - you could go for storing it in the photo library if you get stuck with it...
The database location is specified in the method NSPersistentStoreCoordinator:addPersistentStoreWithType:. I think apple generates this to be in your documents directory. So you are correct in assuming its in the Documents dir.
On your main question
I'm tending to think it is possible to do what you are saying (theres no limits on core data) but it might lead to not a nice experience for the user as it could lead to your app growing in an uncontrolled way. So syncing might slow up and your app might not be politely behaved for the user.
So I don't think its a good idea as it stands if your power users will have 1000s of photos
Perhaps consider introducing a maximum quota of images that the app can deal with and loading/downloading images from an URL which you would specify as a path.
What about using the SD card as an back up option.
Hmm a lot of work I don't envy you. Mayby someone else has done something similar and they could give you a start.
I consulted the following Previous answers on stack overflow which deal with your issues raised mayby they help you to.
Core Data - Storing Images (iPhone)
Storing photos and videos in Core Data?
App Updates, NSURL, and Documents Directory
CoreData (for iphone) storing images
Storing large (e.g. image/movie) files in Core Data on the iPhone
Size limit of my ios app particularly Core Data
Hope this helps some what.

Ipad development architecture

I have a IPad noob question.
Here is the task I am trying to achieve:
I need to build an IPad/IPhone app that will display a lot of images and data. The problem is that this app needs to work offline as well as online. So, the data needs to stored in some way on the IPad.
I am looking for some opinions on techniques/architecture/development.
To provide a bit of background I work mainly in C#.NET and this is my first IPad app. So far I know that I can either create a native app using objective C, or go for an HTML app which later may or may not be converted to a native app.
Furthermore, I am currently testing by creating a simple html page with an image, and trying to cache the image and page so it will work offline. This so far, however is not working as the image or page do not seem to be cached.
EDIT: Does anyone know how much is the caching limit. I believe I have somewhere around 10-15 mbs of images.
I will appreciate any ideas/opinions/resources on this task.
use CoreData to store your images offline Apple CoreData Docs
I am unsure wot you need the online bit for, are you retrieving images off the net or uploading them?

Resources