The nsxpc interface is not invoked

Hello, I encountered such a problem, the scenario is like this:

I have a launchctl startup daemon called xpcserver.app, which uses NSXPC to start an xpc Server. There is a Client program that links to the nsxpc service of this xpcserver.app, and when I establish the connection, I call an interface implemented by xpcserver named setName:(nsstring*)name. I was sure that my xpcserver implemented the corresponding interface, but when the client called the interface to pass the value, it triggered the error "unrecognized selector sent to instance". When I restarted the client, the call to the interface successfully implemented the function.

May I ask why? Using the NSXPC started service, hope to solve, thank you

Replies

Are you using Swift? Or Objective-C?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

i used Objective-C

If you set up a loopback test, do you still see the problem?

I explain how to set this up in TN3113 Testing and debugging XPC code with an anonymous listener.

The code is in Swift but it’s relatively easy to port to Objective-C because there’s a one-to-one mapping between the two.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I'll try that. Thank you

Add a Comment