wix-incubator/DetoxIPC

Invalid connection

Closed this issue · 8 comments

I'm trying to integrate DetoxIPC to open a communication channel between an app and an associated UI Testing runner app.

I fire up the server on the runner app and the client in the main application.

When I try to send a message to the remoteObject _DTXIPCDistantObject:47 is launching an exception because _connection.isValid is false.

I pushed a sample project that replicates the issue here: https://github.com/tcamin/DetoxIPC/tree/master/Issue/testIPC2

I added a podspec to integrate the library.

The order of your code is incorrect. You first launch your app in your tested project, which attempts connection to a non-existent service name "MyService".

Instead, create the server connection in the tester app before launching your application there. The connection should then succeed.

I might think about somehow making the API symmetrical at both sides, and have the first connection become the master, and if an existing connection exists, make the created a slave. But that will still not solve your issue because you attempt to call a method which is not yet exposed in your tested app.

Thanks again for taking a look, working great! One last question, is it expected that it cannot be compiled on physical devices (arm64)?

I’m not sure, I haven’t tried. What error message do you get?

It is not finding symbols for NSConnection. When linking I'm getting:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_NSConnection", referenced from:
      objc-class-ref in DTXIPCConnection.o
  "_NSConnectionDidDieNotification", referenced from:
      -[DTXIPCConnection _commonInit] in DTXIPCConnection.o
      -[DTXIPCConnection initWithRegisteredServiceName:] in DTXIPCConnection.o
      -[DTXIPCConnection _slaveDidConnectWithName:] in DTXIPCConnection.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I see. I’m not sure, perhaps NSConnection is not available on iOS. It’s not a priority for us because we test on simulators, but I’ll take a look.

Any particular reason why you made - (id)synchronousRemoteObjectProxyWithErrorHandler:(void (^)(NSError * _Nonnull))handler unavailable?

It’s not implemented yet.