Quick use of unresolved identifier 'UIApplicationStateInactive'

In my Swift code to handle push notification, I have this line:

if ( application.applicationState == UIApplicationStateInactive  || application.applicationState == UIApplicationStateBackground) {
}

What causes the compilation error: using the unresolved identifier "UIApplicationStateInactive"

Am I missing some import files?

thank

+4
source share
1 answer

You are currently using identifiers for Objective-C. You need to use the id for quick:

UIApplicationState.Inactive // equals UIApplicationStateInactive
UIApplicationState.Background // equals UIApplicationStateBackground

Apple Documentation for:

You can check the documentation for both languages ​​in the Apple documentation and select the language in the upper right corner.

+16
source

Source: https://habr.com/ru/post/1589111/


All Articles