<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Gary,<div><br></div><div>Thanks a lot for your response.</div><div><br><div><div>On May 2, 2013, at 6:19 PM, Gary Byers <<a href="mailto:gb@clozure.com">gb@clozure.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">The behavior that you describe seems
similar to that described in:<br>
<br>
<a class="moz-txt-link-rfc2396E" href="http://stackoverflow.com/questions/10508522/nsopenpanel-doesnt-show-when-i-call-runmodal"><http://stackoverflow.com/questions/10508522/nsopenpanel-doesnt-show-when-i-call-runmodal></a><br>
<br>
where the problem apparently had to do with (lack of proper)
"entitlements". (The owner of the<br>
appliance - quaintly referred to as the "user" in some documents -
might try to access the filesystem<br>
on their "computer" otherwise.)<br>
<br></div></div></blockquote><div><br></div>I believe this is not the same issue I am dealing with. We have enabled the entitlement that he is referencing in this post. Here is our entitlements plist for the file I sent:</div><div><br></div><div><div><plist version="1.0"></div><div><dict></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><key>com.apple.security.app-sandbox</key></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><true/></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><key>com.apple.security.files.user-selected.read-write</key></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><true/></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><key>com.apple.security.network.client</key></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><true/></div><div></dict></div><div></plist></div><div><br></div><div>The com.apple.security.files.user-selected.read-write is the entitlement he references in his post which allows the user to select a location where the application can read and write. </div><div><br></div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix">
I have no idea why this would work on some systems that support
sandboxing and not on others,<br>
but I confess that I had some difficulty parsing your message.
(There's more reason to think that<br>
this is a Lion problem than that it's a Mountain Lion problem, but
I don't know how anyone would<br>
know for sure.)<br>
<br></div></div></blockquote><div><br></div>Sorry if my message was unclear, just to be sure, we have tested this on 3 machines with Mountain Lion and 2 machines with Lion, and so far, the dialog would not show up on any of Lion machines and it showed up on all of the Mountain Lion machines. While this is not a comprehensive test, this does indeed seem to be a Lion only problem. </div><div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix">
There's no reason to think that this is not a CCL problem.
There's no reason to think that it is a<br>
CCL problem, either. If a sandboxed ObjC program with exactly the
same entitlements behaved<br>
differently, then there'd at least be some reason to wonder why
Cocoa methods called from CCL behave<br>
differently than they do when called by that ObjC program. My
model of things is that those Cocoa methods<br>
don't know or care what programming language their callers were
compiled in, and I don't know of any <br>
reason to think of that model as being incorrect.<br>
<br></div></div></blockquote><div><br></div>I have created a Sandboxed ObjC app with the same entitlements and tested it on Lion and Mountain Lion machines and the dialog always pops up. The app simply has a button hooked up to an IBAction that creates the NSOpenPanel when it is pushed. I tried the exact same cocoa code in sandboxed CCL on Lion and the dialog does not pop up. </div><div><br></div><div>Here is the IBAction:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">- (<span style="color: #bb2ca2">IBAction</span>)openDialog:(<span style="color: #bb2ca2">id</span>)pId</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(112, 61, 170); "><span style="color: #000000"> </span>NSOpenPanel<span style="color: #000000"> *panel = [[</span>NSOpenPanel<span style="color: #000000"> </span><span style="color: #3d1d81">alloc</span><span style="color: #000000">] </span><span style="color: #3d1d81">init</span><span style="color: #000000">];</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> [panel <span style="color: #3d1d81">runModal</span>];</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">After creating the app I verified that it had the same entitlements with:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> codesign -dvvv --entitlements :- /Users/Mike/Library/Developer/Xcode/DerivedData/DialogTest-cavpxfrvxshnnmdiqxjdocldarco/Build/Products/Debug/DialogTest.app </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">and it did indeed have the same entitlements:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "><br></div><div style="margin: 0px; "><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;">PropertyList-1.0.dtd"></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><plist version="1.0"></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><dict></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><span class="Apple-tab-span" style="white-space:pre"> </span><key>com.apple.security.app-sandbox</key></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><span class="Apple-tab-span" style="white-space:pre"> </span><true/></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><span class="Apple-tab-span" style="white-space:pre"> </span><key>com.apple.security.files.user-selected.read-write</key></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><span class="Apple-tab-span" style="white-space:pre"> </span><true/></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><span class="Apple-tab-span" style="white-space:pre"> </span><key>com.apple.security.network.client</key></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"><span class="Apple-tab-span" style="white-space:pre"> </span><true/></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"></dict></span></font></div><div style="margin: 0px; "><font face="Menlo"><span style="font-size: 11px;"></plist></span></font></div></div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix">
Googling for "sandbox NSOpenPanel" indicates that many people have
found that these things don't<br>
interact as people expect them to and as the documentation
suggests that they should, and that this<br>
is often due to bugs in the underlying technology. Some messages
that one can easily find via that<br>
Google search suggest that the forums on Apple's developer site
offer a better explanation of what works<br>
and what doesn't than one can easily find elsewhere.<br></div></div></blockquote><div><br></div><div>This is a good suggestion and I have found a lot of good stuff on the Apple Developer boards but I do not know if it would be much help on this issue which does not seem to occur with a similar Xcode project.</div><div><br></div><div>--Mike</div></div></div></body></html>