<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>nsworkspace &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/nsworkspace/</link>
	<description>Feed of posts on WordPress.com tagged "nsworkspace"</description>
	<pubDate>Sat, 19 Jul 2008 22:20:50 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[NSWorkspace Bug in - openFile: ?]]></title>
<link>http://imlocation.wordpress.com/2007/12/07/nsworkspace-bug-in-openfile/</link>
<pubDate>Fri, 07 Dec 2007 20:14:06 +0000</pubDate>
<dc:creator>Vincent Gable</dc:creator>
<guid>http://imlocation.wordpress.com/2007/12/07/nsworkspace-bug-in-openfile/</guid>
<description><![CDATA[EDITED TO ADD: I could reproduce this bug in a large project, but not isolate it in a smaller one.  ]]></description>
<content:encoded><![CDATA[<p>EDITED TO ADD: I could reproduce this bug in a large project, but not isolate it in a smaller one.  It is much likely for my code to have a bug then NSWorkspace.  I'm still not 100% certain that this issue wasn't my fault in some way I don't understand.  But no matter what caused the bug, the work-around I describe here has been working for me.  Please let me know if you have this same issue as well, or any insight into what I could have done to cause it.</p>
<p><b>The Problem:</b><br />
I need to launch a background-application from inside the application-support directory.  The OS is Mac OS X 10.5.1 build 9B18.<br />
<code>[[NSWorkspace sharedWorkspace] openFile:path];</code><br />
where <code>path</code> is the correct path to the application, in my case "/Users/user/Library/Application Support/IMLocation/IMLocationHelper.app.", works about 3 out out 4 times, but intermittently fails.  It also reports success without actually launching IMLocationHelper.app, but this is far more rare.</p>
<p><b>Details:</b><br />
When <code>openFile:</code> explicitly fails, it prints, "<b>LSOpenFromURLSpec() returned -600 for application (null) path /Users/user/Library/Application Support/IMLocation/IMLocationHelper.app.</b>" to stderr.</p>
<p>Error -600 is <code>procNotFound /*no eligible process with specified descriptor*/</code>.</p>
<p>The path is correct, the application exists there.  I verified this by<br />
<code>assert([[NSFileManager defaultManager] fileExistsAtPath:path]);</code><br />
before calling <code>openFile:</code>.</p>
<p>Calling <code>openFile:</code> again immediately after a failure often works</p>
<p>Also, <code>while(![[NSWorkspace sharedWorkspace] openFile:path]);</code><br />
will terminate, meaning it reported success at some point, but it will not always have actually launched the application at <code>path</code>.</p>
<p>(EDITED TO ADD: At first I thought that, NSWorkspace was probably opening IMLocationHelper, but not blocking until it has finished being launched. But sleeping, to give IMLocationHelper time to finish launching, did not solve the problem.)</p>
<p><code> performSelectorOnMainThread</code> did not solve anything ether.</p>
<p>I verify that IMLocationHelper has been launched by<br />
<code>	assert([[<a href="http://imlocation.wordpress.com/2007/06/21/calling-the-command-line-from-cocoa/">ShellTask</a> executeShellCommandSynchronously:@"ps -axww  &#124; grep IMLocationHelper &#124; grep -v grep"] length] &#62; 0);</code> </p>
<p><b>A Workaround:</b><br />
<code>[[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObject:path] waitUntilExit];</code>.</p>
<p>This calls the <a href="http://imlocation.wordpress.com/2007/11/16/useful-macosx-terminal-commands/"><code>open</code></a> command to launch the application.  I have not been able to make it fail when <code>path</code> exists.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[NSApplicationName Inconsistencies]]></title>
<link>http://imlocation.wordpress.com/2007/10/11/nsapplicationname-inconsistencies/</link>
<pubDate>Thu, 11 Oct 2007 03:09:06 +0000</pubDate>
<dc:creator>Vincent Gable</dc:creator>
<guid>http://imlocation.wordpress.com/2007/10/11/nsapplicationname-inconsistencies/</guid>
<description><![CDATA[This article has been updated, and moved here.
]]></description>
<content:encoded><![CDATA[<p>This article has been updated, and moved <a href="http://vgable.com/blog/2008/07/03/nsapplicationname-inconsistencies/">here</a>.</p>
]]></content:encoded>
</item>

</channel>
</rss>
