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
0 comments:
Post a Comment