views:

41

answers:

1

I am using UIImagePickerController to capture video. I have set the delegate to save the captured video when video capture is stopped. The delegate does get called when stopVideoCapture is called by the program based on user action.

I would like the same actions to also happen if while video capture is in progress the user presses the home button to terminate the app.

I tried adding call stopVideoCapture in applicationWillTerminate but for some reason the delegate action to save the video is not being called. The imagePickerController delegate is a separate view controller and not the UIApplicationDelegate.

A: 

As of iOS 4.0, applicationWillTerminate will not be called when the user presses the home button. Instead, see applicationDidEnterBackground: (or have your view controller listen to the UIApplicationDidEnterBackgroundNotification notification). Try setting up a background task with beginBackgroundTaskWithExpirationHandler:.

Ole Begemann
Ole, my app is not supporting background mode so applicationWillTerminate does get called (I verified with breakpoint).
jamihash