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.apple.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 read about Launch Services Database.

Now i am seeking for a solution to get default browser name.

Is there no other way to get default browser name?

If any other way provide me some help.

Suggestions are welcome.

Thanks in advance,

Dhiraj
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to