Post

Replies

Boosts

Views

Activity

WidgetKit: Ignore timeline refresh
Hello, We have created a new iOS 14 widget for our app. The widget creates a session on behalf of the user by using a token that we have stored in the KeyChain, before it fetches data used to create a TimeLine. Our problem is that the token, that we previously used for SiriKit and our old Today-screen widget, has been created with the accessControl value set to kSecAttrAccessibleWhenUnlockedThisDeviceOnly. This means that the widget update fails when it tries to refresh itself when the phone is locked. For all tokens that are created from now on, we have changed the accessControl value to kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, so that everything works properly. The problem is that creating a new token requires the user to perform a two-factor login, and we want to allow our users to do this at their own convenience. Is there a way to ignore a timeline update when this happens? We are using an IntentTimelineProvider. - https://developer.apple.com/documentation/widgetkit/intenttimelineprovider I'm assuming allowing the completion closure to time out is not a good solution. Our alternative is to save each TimeLine Entry in UserDefaults, and reuse the previous Entry in the completion block when this error occurs, but that seems overly complicated.
0
0
514
Oct ’20