events - Best practices for passing data between processes in Cocoa -


I'm in the middle of solving a problem for which I need to do the following in my 64-bit cacao application:

  1. Egg 32-bit Cocoa Helper Tool (Command Line Tool) from within your application. This assistant will open a file (access to a QuickTime movie for a precise time) and access information about that file using the 32-bit API (QuickTime-C API)
  2. 32-bit process Data collected is required to go back to the 64-bit application
  3. The 64-bit app should wait until the 32-bit process is completed before continuing

There are several ways to complete this in Cocoa, but what do I collect

Option 1: NSTK with Pipes

  1. Use NSTask to generate 32-bit process
  2. NSTasks redirect to stdoutput For a pipe, and read from the pipe the data in the 64-bit process.
  3. Paste the data of the pipes, which will be involved in converting the string from data to the data (ints, floats, strings, etc.).

Option 2: NSTask with NSDistributedNotificationCenter

  1. Use NSTask to generate 32-bit process
  2. 32 -BT Process, send an NSNotification to the Distributed Notification Center, and start a dictionary in the event with all the appropriate data.
  3. Membership of the same NSNotification in the 64-bit app

So my question is for stack over flower, which option is "better"? What is the better practice?
Which is more efficient?

I am tilting towards option 2 because it appears that there will be less code in it if these two approaches are not great, is there a better way to do this?

You say that subprocess should be an application for not using NSTK - this launch service is confusing. (If you mean that this is a helpful tool, like an eager expert user can run it from the command line, then NSTK is OK.)

DNC will work in any way, but If the subprocess is really one application, do not use NSTask + NSPipe-distributed objects .


Comments