In the Aerogear iOS OAuth2 library, getting an error when app enters foreground after period of being in background. Specifically, in TrustedPersistantOAuth2Session.swift, KeyChainWrap.read() is (very) occasionally throwing errSecMissingEntitlement and then throwing the user over to Safari for authentication. This is a show stopper bug for our app. Some discussion of the topic and acknowledgement by Apple here: https://forums.developer.apple.com/message/9225#9225.

Best,
Michael Doo