How to exit app and return to home screen in iOS 8 using Swift programming

后端 未结 6 1873
猫巷女王i
猫巷女王i 2020-12-16 12:30

I\'m trying to programmatically return to the home screen in an iOS8 App using Swift. I want to continue the application running in the background though. Any ideas on how

6条回答
  •  感情败类
    2020-12-16 12:54

    Swift 4:

    UIControl().sendAction(#selector(NSXPCConnection.suspend),
                           to: UIApplication.shared, for: nil)
    

    Edit: It's worth mentioning that in iOS 12 there's a bug that will prevent network connectivity if the app is brought back from background after sending the suspend action.

提交回复
热议问题