Make strong reference in notification center callback

pull/16213/head
Muxi Yan 6 years ago
parent 5c275b5f22
commit 4e294d2aa3
  1. 15
      src/objective-c/GRPCClient/GRPCCall.m

@ -531,12 +531,15 @@ static NSString *const kBearerPrefix = @"Bearer ";
- (void)connectivityChanged:(NSNotification *)note {
// Cancel underlying call upon this notification
[self cancelCall];
[self maybeFinishWithError:[NSError errorWithDomain:kGRPCErrorDomain
code:GRPCErrorCodeUnavailable
userInfo:@{
NSLocalizedDescriptionKey : @"Connectivity lost."
}]];
__strong GRPCCall *strongSelf = self;
if (strongSelf) {
[self cancelCall];
[self maybeFinishWithError:[NSError errorWithDomain:kGRPCErrorDomain
code:GRPCErrorCodeUnavailable
userInfo:@{
NSLocalizedDescriptionKey : @"Connectivity lost."
}]];
}
}
@end

Loading…
Cancel
Save