To Rune Warhuus (on Feb 11, 2009):
I know this is an older post, but I was running into a similar problem and found an unlikely solution that worked for me. My specific issue was that Safari would close on its own immediately after the web page loaded, *unless* Safari was already opened. Here's how I solved the issue:
In Xcode, under the "Run" menu there is an option labeled "Stop on Debugger()/Debugger Str()". Try unchecking that option. It made no sense to me as [[NSWorkspace ... openUrl...] is calling the default browser (in my case, too, Safari) to do whatever it takes to access the url, independent of the app I was writing (so I thought, anyway). However, after unticking that "Stop on Debugger()..." option the problem was resolved in my case, and the "problem" web pages remained open.
Apparently, the problem is caused by web pages using Flash, which may trigger the debugging option mentioned, at least according to my source:
http://techstra.bignerdranch.com/Home
Enter page 352 and click Go, and look for the following entry:
"abraun said the following on Jul 2, 2009:"
I thought the issue described by "abraun" was unrelated, since their discussion regarded a Cocoa app that contained its own WebView. I tried the sample code for the chapter in question, and indeed confirmed the crash, and the solution. But I didn't really expected it to work for [[NSWorkspace... openUrl...] Nevertheless, I gave it a shot and it did. Give it a try.
by CD Rivera — Jul 18
I know this is an older post, but I was running into a similar problem and found an unlikely solution that worked for me. My specific issue was that Safari would close on its own immediately after the web page loaded, *unless* Safari was already opened. Here's how I solved the issue:
In Xcode, under the "Run" menu there is an option labeled "Stop on Debugger()/Debugger Str()". Try unchecking that option. It made no sense to me as [[NSWorkspace ... openUrl...] is calling the default browser (in my case, too, Safari) to do whatever it takes to access the url, independent of the app I was writing (so I thought, anyway). However, after unticking that "Stop on Debugger()..." option the problem was resolved in my case, and the "problem" web pages remained open.
Apparently, the problem is caused by web pages using Flash, which may trigger the debugging option mentioned, at least according to my source:
http://techstra.bignerdranch.com/Home
Enter page 352 and click Go, and look for the following entry:
"abraun said the following on Jul 2, 2009:"
I thought the issue described by "abraun" was unrelated, since their discussion regarded a Cocoa app that contained its own WebView. I tried the sample code for the chapter in question, and indeed confirmed the crash, and the solution. But I didn't really expected it to work for [[NSWorkspace... openUrl...] Nevertheless, I gave it a shot and it did. Give it a try.