Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shweta13

macrumors member
Original poster
Aug 7, 2008
38
0
Hi everyone,

I am unable to invoke safari application through my simple cocoa windows application.
Can someone help?

P.S. I am not using any view based application.
 

hhas

macrumors regular
Oct 15, 2007
126
0
How about using NSWorkspaces openURL: method?

The OP isn't specific about what they want to do, but if all they want is to open a webpage then I'd second the above, particularly as it'll work with the user's default browser even if it isn't Safari.

OTOH, if they want to interact in some other way, or with Safari in particular, then Apple events are the way to go, either by executing an embedded AppleScript via NSAppleScript (crude, but may be sufficient for simple tasks), or using one of the available ObjC-Apple event bridges (e.g. objc-appscript's svn repository contains a sample project that shows how how to fetch the URL from the front Safari document).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.