Reputation: 83
I am not able to record screen in my swift app once the home button of iphone is clicked(i.e. when the app is suspended)
Explanation:
In my Swift App,I have created buttons to record/stop, declared an object(myScreenView) of bridged Objective C Class as IBoutlet and connected it to my view. When I click on record button,a bridged Objective C method is called which records the screen.(the Code is as follows)
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func recordAction(sender: AnyObject?){
myScreenView.StartRecording()
}
@IBAction func stopAction(sender: AnyObject?){
myScreenView.StopRecording()
}
From the Above, I am able to record screen when my App is in Foreground but when the home button is pressed it stops recording.
Actions taken:
Please Advice what is to be done to record screen when app is pushed to background.
Upvotes: 1
Views: 1850
Reputation: 1070
This isn't possible. Once an app is closed, it cannot execute pretty much any code (with the exceptions of Push Notifications).
Application running in background is reserved for very basic functions (not camera recording - Im guessing because it would pose a security risk).
Upvotes: 1