UIImagePickerController to take multiple pictures and save them in Document directory ony by one - ios

I need my app to provide users to click multiple pictures. I want a layout with two separate buttons, one for clicking picture and another for saving the picture taken in the document's directory of filesystem. This screen will be presented and UIImagePickerController will be opened.
When user clicks first button, we will disable this button and show the picture obtained in an overlay. And show another button(this will be enabled now) to save this picture.
When user clicks another button, we will disable this button and save it in filesystem. After saving successfully, we will again enable the first button to take more pictures.
I have tried and implemented this app and it works perfectly at our end. But our some users report of app crashing when UIImagePickerOriginalImage key returned is nil.
This doesn't even happen to them frequently. Instead they face this crash after a long usage of app. However, we have tried of taking more 200 pictures and saving too. It didn't lead to any crash.
Please anyone suggest what might be the cause for this crash. Or any other better workaround to implement this functionality.

Related

Request for access to photo library prompt stays in the background

My request for photo library permissions prompt is supposed to pop up as soon as the app is launched. I have set up my info.plist with the library permission.
I have tried both adding/removing the requestAuthorization(_:) function in my AppDelegate.swift in various lifecycle functions.
Current output: The app launches and stays on the launchscreen. When i click on the home button the app minimizes and the permissions prompt appears(as though it was lingering in the background). On allowing permission everything launches as expected.
Desired output: The app launches and the photo library permissions prompt appears on top(as it should). On click of which everything runs as usual.
I can attach pictures if this is not descriptive enough. Also there is no pertaining code as i have removed the requestAuthorization(_:) function(cuz not required). Any tip would go a long way as I have been fiddling with this for days now trying to get this fixed. Thank you!
Your request call should be in the view controller (i.e. viewDidAppear), not the AppDelegate. Having the call in the app delegate is probably causing it to fire at an inappropriate time.

Function execution if next view is loaded

I am new to Parse and iOS app development, so please pardon my question if the answer is obvious.
Does a function execution continue if the next view in a view hierarchy (nav controller) is loaded?
I currently have a view where the user takes a picture, which is then displayed on screen. I want to begin the upload and packaging of this image immediately, to save time. So my question really deals with the [saveInBackground] and [getObjectInBackground] functions. If the user taps the button to go to the next view, before the upload is completed, will the functions stop their execution or continue until it completes?
Thanks
Siddharth
As long as you use the function saveInBackground, your photo will be saved even if switching views. If you used saveEventually then the photo would be saved whenever it can (if there is no internet it will upload it when internet becomes available).

Chromecast - block loadMedia until the previous one returns

I'm writing an iOS app that uses chromecast to cast a series of pictures. When the user taps on the right edge of the current picture, the app presents the next picture, and the next picture is casted to the bigger screen. However, if the user taps fast enough and brings up the third picture before the second picture shows up on the bigger screen, the second picture, once shows up, will stay there even though the third picture shows up on the device. From the Google Cast SDK it looks like all the casting requests are queued up and the third one should show up automatically. So does this mean I have to queue the requests manually on the sender side?
I imagine your images are available on a server (which could be your phone as well). What receiver are you using? What is the behavior you expect to have? If, for example, you need to see all the images no matter how fast you cast them, then your receiver should queue the urls of images and when is completely loaded, loads the next one, etc. If you expect to skip over the previous images if a new one is casted, then your receiver should drop the previous requests as soon as a new one comes in.
You can queue them on the sender side as well (especially for the first scenario) and your sender should listen to "image is fully loaded so send in the next one) but that is not optimal since
your app creates a better experience if the next image is loaded behind the scene on the receiver while the first one is being shown so it can quickly transition to the next one and
You probably want to provide an experience that if you queue up some photos, your app can play them on the TV even if your phone gets disconnected (only relevant if images are served from a separate server).
Another factor to consider is what do you expect if a second device is connected to your Chromecsst while the first one is casting; do you want to the second one be able to "participate" in the activity and cast as well or not.
Regardless, there is a sample code on our github repo that shows a simple playlist for videos (queued up on the receiver).

Limiting the user from saving the screen

I am making an app that allows the user to add captions to their photos. I'd like to be able to allow the user to save / share 3 of their creations, and after they share for the third time, shut down the app until they purchase more credits.
I'm trying to think of ways that the user can get around this to use my app for free all the time. The only way I can think that the user can save a photo manually is to do a screen shot, which I know how to detect so I'm not worried about. Is there anything else I'm not thinking of?
You can do it in an indirect way like the Snapchat app. Taking a screenshot interrupts any screen touches. See this for the solution.
You can trap the screen shot event and if they do create a screen shot you can delete it.
You can display some watermarks .
Remove watermark only after they buy it.
Here is a stackoverflow link to add watermarks

Validating iOS screen for user errors

I have developed an iOS enterprise app for iPad. When it is launched it connects to a webservice, gets some data, and stores it in Core Data. Then the next screens use this data and do what is needed, like fill UITextFields, drop downs, show the user a UIAlertView, etc. Basically i use the data, manipulate it, and save it.
Consider this: I install the app now in morning, I use it immediately, and then I click the home button on iPad and leave it there for couple of hours. I then launch the app, and it shows a black screen before crashing and going back to iPad main menu.
Why is it crashing like that? Any ideas?
If you need more information please let me know.
You need to check your logs for errors.
Plug your device to your computer and open Xcode/Organizer/Devices/Device Logs

Resources