Fixed threading in ios
This commit is contained in:
parent
9429adb034
commit
479c5003bd
@ -20,11 +20,18 @@ NSOutputStream *outputStream;
|
||||
|
||||
inputStream = (__bridge NSInputStream *)readStream;
|
||||
[inputStream setDelegate:self];
|
||||
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
//[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
[inputStream open];
|
||||
|
||||
outputStream = (__bridge NSOutputStream *)writeStream;
|
||||
[outputStream open];
|
||||
|
||||
[self performSelectorOnMainThread:@selector(runReadLoop) withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
||||
|
||||
- (void)runReadLoop {
|
||||
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
- (void)close {
|
||||
|
@ -69,6 +69,7 @@
|
||||
[self.commandDelegate runInBackground:^{
|
||||
@try {
|
||||
[socket connect:host port:port];
|
||||
|
||||
[self.commandDelegate
|
||||
sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK]
|
||||
callbackId:command.callbackId];
|
||||
|
Loading…
Reference in New Issue
Block a user