i've Created Safari Extension [Created via native way]
in which , i'm stucked in to open new tab into safari browser
onClick of the Button :
- (IBAction)btnClick:(id)sender {
[self.sfWindow openTabWithURL:[NSURL URLWithString:@"https://www.facebook.com"] makeActiveIfPossible:true completionHandler:^(SFSafariTab * _Nullable tab) {
NSLog(@"Naman Vaishnav");
}];}
In which I'm getting self.sfWindow : null
CFURLRef httpURL = CFURLCreateWithString(kCFAllocatorDefault, CFSTR("http://"), NULL);
NSLog(@"%@", LSCopyDefaultApplicationURLForURL(httpURL, kLSRolesAll, nil));
NSString *strDefaultBrowser = [NSString stringWithFormat:@"%@",LSCopyDefaultApplicationURLForURL(httpURL, kLSRolesAll, nil)];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:websiteName]];