1 Reply
      Latest reply on Oct 29, 2019 4:22 AM by eskimo
      Rickpm Level 1 Level 1 (0 points)

        Can XPC shared memory be used if the app & extension is using the NSXPCConnection instead of the XPC Services API?

        • Re: xpc api
          eskimo Apple Staff Apple Staff (13,905 points)

          Yes.  In 10.14 and later you can transport arbitrary low-level XPC types across NSXPCConnection using -setXPCType:forSelector:argumentIndex:ofReply:.  However, it’s possible to do this on older systems as well: The trick is to use the Posix shared memory API (see the shm_open man page), which works in terms of file descriptors.  You can then wrap that file descriptor in an NSFileHandle, which is XPC transportable.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"