I'm getting a weird issue where code which works in one XCode project fails to compile in another. Both run Swift4.2.
Why do I get "UIBackgroundTaskIdentifier has no member 'invalid' error?
import UIKit import Foundation
//Type 'UIBackgroundTaskIdentifier' (aka 'Int') has no member 'invalid'
var backgroundTask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid
I can jump into the UIBackgroundTaskIdentifier definition and see this:
I had the same problem. Solved using UIBackgroundTaskInvalid
instead of .invalid
var backgroundTask: UIBackgroundTaskIdentifier = UIBackgroundTaskInvalid
Not sure why it acts so strange. In the example from raywenderlich.com code compiles without errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With