objective c - Using SBApplication to open a URL in Safari? -
i'm trying use sbapplication tell couple of browsers (safari , chrome) open given url. however, apps treat file url. here's pseudo/jstalk code i'm using:
var safari = [sbapplication applicationwithbundleidentifier:@"com.apple.safari"]; var url = [nsurl urlwithstring:@"http://apple.com/"]; [safari open:url]; // results in opening "file:///http/::apple.com:"
any hints? making safari.h file sdp ( sdef /applications/safari.app | sdp -fh --basename "safari" ) doesn't see can do.
just read wish open url using multiple browsers. thus, answer isn't of here:
i'd propose ask nsworkspace open url:
// make url nsurl *someurl = [nsurl urlwithstring:@"http://my.server.vom/" ]; if ([[nsworkspace sharedworkspace] openurl:someurl]) { nslog(@"fine. url opened."); } else { // shouldn't happen }
regarding problem: did try pass string safari, not nsurl?
Comments
Post a Comment