Razz
Razz

Reputation: 83

How to record screen when app is in Background ios 8.4(Swift)

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:

  1. Checked Audio and Airplay and Background Fetch checkbox in App Capabilities
  2. Set "NO" to "Application does not run in background” info property.

Please Advice what is to be done to record screen when app is pushed to background.

Upvotes: 1

Views: 1850

Answers (1)

Ty Pavicich
Ty Pavicich

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

Related Questions