I’ve been working on an error in my program but I cannot seem to find a solution.
When the user opens the camera the UIImagePickerController is displayed and works great.
Although when he presses the home button on the iPhone I want to remove an object from an NSMutableArray.
For instance:
The user opens the camera.
An object is added to an NSMutableArray in another class.
The user presses the home button
The object should be removed.
I can’t call the remove method when the application moves to the background because I need the other object to remain in the array for background location services.
Is there a way to catch the event when either pressing the home button or when the UIImagePicker closes itself by the home button event?
You will have to post notication. For that in appDelegate method:
Now were you open UIImagePickerController in your view controller and its viewDidLoad method
add selector method in your view controller were you will remove your object as it will be called when home button is pressed.