File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ - (dispatch_queue_t)methodQueue
2424 return dispatch_get_main_queue ();
2525}
2626
27+ UIBackgroundTaskIdentifier taskId;
28+
2729/* ! @brief Number of random bytes generated for the @ state.
2830 */
2931static NSUInteger const kStateSizeBytes = 32 ;
@@ -205,12 +207,20 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
205207 }
206208 appDelegate.authorizationFlowManagerDelegate = self;
207209 __weak typeof (self) weakSelf = self;
210+
211+ taskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler: ^{
212+ [UIApplication.sharedApplication endBackgroundTask: taskId];
213+ taskId = UIBackgroundTaskInvalid;
214+ }];
215+
208216 _currentSession = [OIDAuthState authStateByPresentingAuthorizationRequest: request
209217 presentingViewController: appDelegate.window.rootViewController
210218 callback: ^(OIDAuthState *_Nullable authState,
211219 NSError *_Nullable error) {
212220 typeof (self) strongSelf = weakSelf;
213221 strongSelf->_currentSession = nil ;
222+ [UIApplication.sharedApplication endBackgroundTask: taskId];
223+ taskId = UIBackgroundTaskInvalid;
214224 if (authState) {
215225 resolve ([self formatResponse: authState.lastTokenResponse
216226 withAuthResponse: authState.lastAuthorizationResponse]);
You can’t perform that action at this time.
0 commit comments