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