Manisha
Manisha

Reputation: 382

How to force UIApplicationDidEnterBackgroundNotification in app

I'm really not sure if we can post the UIApplicationDidEnterBackgroundNotification from the app.

Suppose I have a sample app with a button and when I tap on the button it should post the UIApplicationDidEnterBackgroundNotification notification.

Is it really possible?

Upvotes: 0

Views: 130

Answers (1)

Samir Shaikh
Samir Shaikh

Reputation: 557

 UIApplication.shared.perform(#selector(NSXPCConnection.suspend))

its working but may be its violate apple's guidline.

Quitting your application or sending it to the background programmatically is a violation of the [iOS Human Interface Guidelines][1], which usually doesn't bode well for getting through the review process.

Upvotes: 1

Related Questions