@@ -176,11 +176,9 @@ - (void)appCheckTokenDidChangeNotification:(NSNotification*)notification {
176176}
177177
178178Future<AppCheckToken> AppCheckInternal::GetAppCheckToken (bool force_refresh) {
179- SafeFutureHandle<AppCheckToken> handle =
179+ __block SafeFutureHandle<AppCheckToken> handle =
180180 future ()->SafeAlloc <AppCheckToken>(kAppCheckFnGetAppCheckToken );
181181
182- // __block allows handle to be referenced inside the objective C completion.
183- __block SafeFutureHandle<AppCheckToken>* handle_in_block = &handle;
184182 [impl ()
185183 tokenForcingRefresh: force_refresh
186184 completion: ^(FIRAppCheckToken* _Nullable token, NSError * _Nullable error) {
@@ -190,18 +188,18 @@ - (void)appCheckTokenDidChangeNotification:(NSNotification*)notification {
190188 int error_code = firebase::app_check::internal::AppCheckErrorFromNSError (error);
191189 std::string error_message = util::NSStringToString(error.localizedDescription );
192190
193- future ()->CompleteWithResult (*handle_in_block , error_code, error_message.c_str (),
191+ future ()->CompleteWithResult (handle , error_code, error_message.c_str (),
194192 cpp_token);
195193 return ;
196194 }
197195 if (token == nil ) {
198196 NSLog (@" App Check token is nil." );
199- future ()->CompleteWithResult (*handle_in_block , kAppCheckErrorUnknown ,
197+ future ()->CompleteWithResult (handle , kAppCheckErrorUnknown ,
200198 " AppCheck GetToken returned an empty token." ,
201199 cpp_token);
202200 return ;
203201 }
204- future ()->CompleteWithResult (*handle_in_block , kAppCheckErrorNone , cpp_token);
202+ future ()->CompleteWithResult (handle , kAppCheckErrorNone , cpp_token);
205203 }];
206204 return MakeFuture (future (), handle);
207205}
0 commit comments