Search code examples
iosuikit

What is the actual raw integer value of UIBackgroundTaskInvalid?


I am currently working in Xamarin iOS where I don't have access to the following constant: https://developer.apple.com/documentation/uikit/uibackgroundtaskidentifier/1622983-invalid

I would like to be able to default my task ID variable to the invalid constant value and also be able to check the return value of beginBackgroundTask to ensure that the value returned is valid.

Would anyone be able to help me out? I understand the value may change in future versions of iOS, but I can always update my code accordingly in the future.

Thank you!


Solution

  • The raw value is 0. That is the full answer, but it is too short for StackOverflow so:

    assert(UIBackgroundTaskIdentifier.invalid.rawValue == 0)