THRIFT-3406 Cocoa client should not schedule streams on main runloop
Client: Cocoa
Patch: Aleksei Shevchenko
diff --git a/lib/cocoa/src/transport/TSSLSocketTransport.m b/lib/cocoa/src/transport/TSSLSocketTransport.m
index ab5eb3d..1b1214f 100644
--- a/lib/cocoa/src/transport/TSSLSocketTransport.m
+++ b/lib/cocoa/src/transport/TSSLSocketTransport.m
@@ -126,12 +126,12 @@
 
     inputStream = (__bridge NSInputStream *)readStream;
     [inputStream setDelegate:self];
-    [inputStream scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
+    [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
     [inputStream open];
 
     outputStream = (__bridge NSOutputStream *)writeStream;
     [outputStream setDelegate:self];
-    [outputStream scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
+    [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
     [outputStream open];
 
     CFRelease(readStream);
diff --git a/lib/cocoa/src/transport/TSocketTransport.m b/lib/cocoa/src/transport/TSocketTransport.m
index 1b8fe9b..272baf6 100644
--- a/lib/cocoa/src/transport/TSocketTransport.m
+++ b/lib/cocoa/src/transport/TSocketTransport.m
@@ -46,12 +46,12 @@
 
     inputStream = (__bridge NSInputStream *)readStream;
     [inputStream setDelegate:self];
-    [inputStream scheduleInRunLoop:NSRunLoop.mainRunLoop forMode:NSDefaultRunLoopMode];
+    [inputStream scheduleInRunLoop:NSRunLoop.currentRunLoop forMode:NSDefaultRunLoopMode];
     [inputStream open];
 
     outputStream = (__bridge NSOutputStream *)writeStream;
     [outputStream setDelegate:self];
-    [outputStream scheduleInRunLoop:NSRunLoop.mainRunLoop forMode:NSDefaultRunLoopMode];
+    [outputStream scheduleInRunLoop:NSRunLoop.currentRunLoop forMode:NSDefaultRunLoopMode];
     [outputStream open];
   }
   else {