I have an app (App1) that creates a temp file that then needs to be opened in 
another app (App2), which the first app launches using NSTask with several 
arguments, one of which is the temp file created by App1.

To create the temp file name and path I use the following snippet:
        NSString *tempDir = NSTemporaryDirectory();
        if( !tempDir ) {
                tempDir = @"/tmp";
            }
        NSString *uniqueFileName = [[NSProcessInfo 
processInfo]globallyUniqueString];
        NSString *filePath = [tempDir 
stringByAppendingPathComponent:uniqueFileName];
        NSString *uniqueFilePath = [filePath 
stringByAppendingPathExtension:@"stl"];
        
  
Then I create an NSTask with arguments, one of which is the uniqueFilePath and 
I then launch it.

               On Mac 10.8.4 the file is correctly passed from App1 to App2 
which is able to open it – ALL IS WELL
               On Mac 10.7.5 the file is NOT correctly passed from from App1 to 
App2 which opens without a file. – BUG
                              I get in the console log a deny file-write-data 
for A3DP on the file.
 
I suspect that the issue is caused by the fact that to get a writable temp 
directory I am using NSTemporaryDirectory() from within App1 and then when App2 
tries to open the file in that directory it does not have the correct 
permission to do so and the sandbox stops it.
 
My question is, how can I share a temp file between App1 and App2 on Mac? Where 
is the right place to temporarily save the file I want to pass between the 
apps? Or do I need to configure the sandbox in some way?
 
Thanks.
S.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to