Closed iambatoan closed 8 years ago
This has been reported before. I'm going to look into it today
It seems not working. I connect and disconnect once, the exception still happens. I saw that property connected is true when i have disconnected already.
Are you on the latest version of the client?
Yeah, i am on the latest version, just connect and disconnect, then I will get the exception
How are you creating the client? Can you give some examle code?
I have a singleton to manage the socket, this is my sample code, I have a button that call connect when click, and disconnect when click again
- (void)connectWithSuccess:(void (^ __nonnull)())success {
[self.socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
[self findMatch];
}];
[self.socket on:@"disconnect" callback:^(NSArray* data, SocketAckEmitter* ack) {
NSLog(@"disconnected");
}];
[self subscribeJoinedRoomWithCallBack:success];
[self.socket connect];
}
- (void)findMatch {
[self.socket emit:@"findMatch" withItems:@[]];
}
- (void)disconnect {
[self.socket disconnect];
}
I mean how you're creating the socket
Sorry for not understanding your question clearly, here are my sample code
+ (instancetype __nonnull)sharedManager {
static RCSocketIOManager *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[RCSocketIOManager alloc] init];
instance.socket = [[SocketIOClient alloc] initWithSocketURL:kBaseSocketURL opts:nil];
});
return instance;
}
I'll have to look into this more. Not really sure what's going on.
Are you trying to connect and disconnect from different dispatch_queues?
Same queue, but I notice that the issue only happens on ios 9 device or simulators. In ios 8.x, it works perfectly.
Do you have a stack trace or something?
I'm having trouble reproducing.
I tested in 3 iOS 9.0.1 devices and get the exception, 4 iOS 8.x devices work fine. In iOS 8.x, it only shows the "Attempted to create a task in a session that has been invalidated", but in iOS 9, it shows and crashes. This is the screen shot: http://take.ms/DCiXh
I'll look into it later today. You could try forcing polling as a workaround until I figure it out
Does the latest master do anything about it?
I use cocoapods then the issue seems disappear. Before I dragged the source files to my project for supporting iOS 7.
how to cancel almofire download request after doing Manager.sharedInstance.session.invalidateAndCancel() .... this i have getting this error.
Attempted to create a task in a session that has been invalidated 2016-07-02 16:52:57.354 FlydeApp[19981:191244] *\ Terminating app due to uncaught exception 'NSGenericException', reason: 'Task created in a session that has been invalidate
I always get this exception when I try to connect and disconnect many times, am I wrong or any way to fix this issue? Thank you