@@ -176,11 +176,9 @@ - (void)appCheckTokenDidChangeNotification:(NSNotification*)notification {
176
176
}
177
177
178
178
Future<AppCheckToken> AppCheckInternal::GetAppCheckToken (bool force_refresh) {
179
- SafeFutureHandle<AppCheckToken> handle =
179
+ __block SafeFutureHandle<AppCheckToken> handle =
180
180
future ()->SafeAlloc <AppCheckToken>(kAppCheckFnGetAppCheckToken );
181
181
182
- // __block allows handle to be referenced inside the objective C completion.
183
- __block SafeFutureHandle<AppCheckToken>* handle_in_block = &handle;
184
182
[impl ()
185
183
tokenForcingRefresh: force_refresh
186
184
completion: ^(FIRAppCheckToken* _Nullable token, NSError * _Nullable error) {
@@ -190,18 +188,18 @@ - (void)appCheckTokenDidChangeNotification:(NSNotification*)notification {
190
188
int error_code = firebase::app_check::internal::AppCheckErrorFromNSError (error);
191
189
std::string error_message = util::NSStringToString(error.localizedDescription );
192
190
193
- future ()->CompleteWithResult (*handle_in_block , error_code, error_message.c_str (),
191
+ future ()->CompleteWithResult (handle , error_code, error_message.c_str (),
194
192
cpp_token);
195
193
return ;
196
194
}
197
195
if (token == nil ) {
198
196
NSLog (@" App Check token is nil." );
199
- future ()->CompleteWithResult (*handle_in_block , kAppCheckErrorUnknown ,
197
+ future ()->CompleteWithResult (handle , kAppCheckErrorUnknown ,
200
198
" AppCheck GetToken returned an empty token." ,
201
199
cpp_token);
202
200
return ;
203
201
}
204
- future ()->CompleteWithResult (*handle_in_block , kAppCheckErrorNone , cpp_token);
202
+ future ()->CompleteWithResult (handle , kAppCheckErrorNone , cpp_token);
205
203
}];
206
204
return MakeFuture (future (), handle);
207
205
}
0 commit comments