armadsen / ORSSerialPort

Serial port library for Objective-C and Swift macOS apps
MIT License
751 stars 183 forks source link

Data reading in Modal Window #153

Open freespirit83xyz opened 4 years ago

freespirit83xyz commented 4 years ago

Hello to all, I'm here to show an issues that I encountered working with modal window. The issue was that serial port received data but not notify to delegate until the modal window stops. The guilty command is -(void)receiveData:(NSData *)data in ORSSerialPort.m

I replaced dispatch_async block with [self performSelectorOnMainThread:@selector(notifyDelegate:) withObject:data waitUntilDone:NO]; and added -(void) notifyDelegate:(NSData *)data { if ([self.delegate respondsToSelector:@selector(serialPort:didReceiveData:)]) { [self.delegate serialPort:self didReceiveData:data]; } }

Hope this can help and the fix will be implemented in next releases.