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
24
24
return dispatch_get_main_queue ();
25
25
}
26
26
27
+ UIBackgroundTaskIdentifier taskId;
28
+
27
29
/* ! @brief Number of random bytes generated for the @ state.
28
30
*/
29
31
static NSUInteger const kStateSizeBytes = 32 ;
@@ -205,12 +207,20 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
205
207
}
206
208
appDelegate.authorizationFlowManagerDelegate = self;
207
209
__weak typeof (self) weakSelf = self;
210
+
211
+ taskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler: ^{
212
+ [UIApplication.sharedApplication endBackgroundTask: taskId];
213
+ taskId = UIBackgroundTaskInvalid;
214
+ }];
215
+
208
216
_currentSession = [OIDAuthState authStateByPresentingAuthorizationRequest: request
209
217
presentingViewController: appDelegate.window.rootViewController
210
218
callback: ^(OIDAuthState *_Nullable authState,
211
219
NSError *_Nullable error) {
212
220
typeof (self) strongSelf = weakSelf;
213
221
strongSelf->_currentSession = nil ;
222
+ [UIApplication.sharedApplication endBackgroundTask: taskId];
223
+ taskId = UIBackgroundTaskInvalid;
214
224
if (authState) {
215
225
resolve ([self formatResponse: authState.lastTokenResponse
216
226
withAuthResponse: authState.lastAuthorizationResponse]);
You can’t perform that action at this time.
0 commit comments