Skip navigation

LSGetApplicationForURL() failed

663 Views 7 Replies Latest reply: Apr 24, 2013 9:04 PM by Dhiraj Bhor RSS
Dhiraj Bhor Calculating status...
Currently Being Moderated
Apr 19, 2013 2:38 AM

Hi,

I am developing an application tool that requires a function which will give me users default browser name.

I have code as below

 

     FSRef appRef;

     CFURLRef inUrl;

     OSStatus status;

     CFStringRef urlString;

     CFURLRef appUrlRef;

     CFStringRef defBrowserName;

 

     cfURLStr = CFStringCreateWithCString(kCFAllocatorDefault, "http://www.quickheal.com", kCFStringEncodingUTF8);

     if (NULL == urlString)                                exit(-1);


  inUrl = CFURLCreateWithString(NULL, urlString, NULL);

     status = LSGetApplicationForURL(inUrl, kLSRolesEditor, &appRef, &appUrlRef);

     if (noErr != status)     {  CFRelease(inUrl);           CFRelease(urlString); exit(-1);  }

 

     defBrowserName = CFURLCopyLastPathComponent(inUrl);

NSLog(@"Here is Default Browser Name %@", (NSString *)defBrowserName);

 

This code works well when i am normal user. But when i ran same code as super user, it give me error

that


LSGetApplicationForURL() failed. Error:(-10814)

 

Why this happened?

I am waiting for some quick replies which i had not got last time.

Thanks in advance,

Dhiraj


Mac mini, Mac OS X (10.6.4)

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.