GDChannel
GDChannel copied to clipboard
In simulator, create new event bus will throw an exception
To reproduce, turning off the internet and creating a event bus on iOS simulator. It will throw this following exception. I did check network connection with reachability but it won't work for simulator because simulator will NOT get correct network status from it.
The best way to fix this bug, it is to throw GDC_BUS_ON_ERROR message when the connection to the server fails.
*** -[ComGoodowRealtimeObjcObjCWebSocket retain]: message sent to deallocated instance 0x10f180af0
It would fail at the following line because self.delegate has already been deallocated.
- (void)_failWithError:(NSError *)error;
{
dispatch_async(_workQueue, ^{
if (self.readyState != SR_CLOSED) {
_failed = YES;
[self _performDelegateBlock:^{
"failed at this line" => if ([self.delegate respondsToSelector:@selector(webSocket:didFailWithError:)]) {
[self.delegate webSocket:self didFailWithError:error];
}
}];
self.readyState = SR_CLOSED;
_selfRetain = nil;
SRFastLog(@"Failing with error %@", error.localizedDescription);
[self _disconnect];
}
});
}