Ipad development architecture - ipad

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?

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.

Cordova / Phonegap app (lots of images) dealing with memory warnings

I am trying to wrap my website into an app that I made with AngularJS.
I got a website with lots of "cards" divs, and each of them hv an image on them.
you can find the link here: cow.aforadrian.com
screenshot of what i did in the web version
each page will hv about 100 "cards" with each unique image, loading from local JSON file. It went well in the browser
I package all the images locally into an app.
It worked all good on iOS simulator and even on my new iPad Air.
But then I realise it wont work in other devices with lesser memories.
It averagely took up to 260MB ram... and sometimes go way up to 500MB...
I tried to disable all css visual or transformation effects but it didnt help much.
At first I thought it was the size of the images, but I hv checked and try using small thumbnail to test, the memory issue still persists.
so I guess it had to do with how the screen handles the rendering of this amount of images.
I m not very good with angularjs and barely get this site up and running. it got me scratching my head on how to fix this. I never worked with an app before so the memory issue really didnt occur to me and i dun hv a concept of how to deal with this.
Other threads hv talked about similar issues on creating image carousel, that one should lazyload the image before and destroy the image after. Yet I am not sure if this is the right approach for me, and I am not sure how to achieve this.
UPDATE:
I am using ng-repeat to load image links pointing to a local image folder.
Is this the reason why it is using up a lot of RAM/Memory? are there better way to achieve this? will it help if i revamp the website in ionic framework instead of pure Angularjs + Cordova?

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.

Share Files between Apps on the same iPad (Without iCloud)

I have two iPad apps, one which downloads data from a server and stores it on the iPad and another one (the main app) which uses the data later.
(It would make sense to combine the two but it's a client requirement)
But I see no way to share the data between the two apps.
I have heard there are ways to do it using:
Custom URL Schemes
Document Support on iPad Devices
UIPasteboard
But I cannot find any thing explaining how to use any of these effectively.
Can anyone point me in the right direction.
Just to clarify:
It is an iPad only app
Both apps will not run at the same time
Basically I need to access the documents or caches folder of one app from another
Using iCloud or any other third part service is not possible
It would be great if I could make the downloader app into a sort of configuration page for the main app (if it is even possible)
So keeping these in mind which one would be the most suitable?
This link at github may be useful... Looks like someone has already made a file manager, using these elements you may be able to do what you are looking for. But as far as I know, your app is extremely sandboxed and does not really interact with other apps/the file system very much at all (Apple is very limiting that way)
EDIT
this post seems to have the explanations of local data sharing methods you were looking for. None of the methods in this post requires any connectivity, just a device and 2 apps :) Good luck!

How to combine pdfs for iOS app

Can anyone help with combining two pdf's together on an iPad? I dont know where to start.
I have an app that contains a lot of single page pdf's and I want to be able to allow the user to merge them together for printing and emailing if they wish.
I have looked at the various CGPDF classes but dont know where to begin.
I am sorry that I don't have an answer for your exact question, but Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints? is an excellent place to start. When I first started with all of this I used the iText library from Java to see what was actually going on behind the scenes with properties etc (since all the iOS CGPDF classes are Opaque).

Resources