Note that there are some explanatory texts on larger screens.

plurals
  1. POBest practices for passing data between processes in Cocoa
    primarykey
    data
    text
    <p>I am in the middle of solving a problem which requires me to do the following in my 64-bit Cocoa application:</p> <ol> <li>Spawn a 32-bit Cocoa helper tool (command line tool) from within my application. This helper will open a file (a quicktime movie to be precise) and access information about that file using 32-bit only APIs (Quicktime-C APIs)</li> <li>The data gathered from the 32-bit process needs to be passed back to the 64-bit application. </li> <li>The 64-bit app should wait until the 32-bit process completes before continuing</li> </ol> <p>There are many ways to accomplish this in Cocoa, but from what I gather these are two approaches I could take.</p> <h2>Option 1: NSTask with Pipes</h2> <ol> <li>Use NSTask to spawn the 32-bit process</li> <li>Redirect the NSTasks stdoutput to a pipe, and read data from that pipe in the 64-bit process.</li> <li>Parse the data from the pipe, which will involve converting strings from stdout into data (ints, floats, strings, etc.)</li> </ol> <h2>Option 2: NSTask with NSDistributedNotificationCenter</h2> <ol> <li>Use NSTask to spawn the 32-bit process</li> <li>When data is ready in the 32-bit process, send an NSNotification to the Distributed notification center, and inlude a dictionary in the event with all of the pertinent data.</li> <li>In the 64-bit app subscribe to the same NSNotification</li> </ol> <p>So my question for StackOverflowers' is, which option is "better"?<br> Which is a better practice?<br> Which is more efficient? </p> <p>I'm leaning towards Option 2 because is seems like there will be less code involved. If these two approaches aren't great, is there a better way to do this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload