Search code examples
ioscore-data

iOS - best practice to wait for protected data become available?


i wonder if it's ok to defer app-start while protectedData isn't available ...

i mean something like

    while !UIApplication.shared.isProtectedDataAvailable {
        Thread.sleep(forTimeInterval: 0.05)
    }

Solution

  • No, it’s not OK, sleep is the worst practice.

    Don’t wait, there is the protectedDataDidBecomeAvailableNotification notification