From e45f7b87395773d48ac9023e4aca4012c6c9a610 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Thu, 15 Feb 2018 23:00:45 +0100 Subject: [PATCH] changed open mechanics to use 10.10 APIs to try to fix 10.13 launch bugs with chrome --- MacPass/MPEntryViewController.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 5de57cd9..06d6f43e 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -714,15 +714,17 @@ NSString *const _MPTableSecurCellView = @"PasswordCell"; webURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [expandedURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; } - NSString *browserBundleID = [[NSUserDefaults standardUserDefaults] objectForKey:kMPSettingsKeyBrowserBundleId]; + NSString *browserBundleID = [NSUserDefaults.standardUserDefaults stringForKey:kMPSettingsKeyBrowserBundleId]; + NSURL *browserApplicationURL = browserBundleID ? [NSWorkspace.sharedWorkspace URLForApplicationWithBundleIdentifier:browserBundleID] : nil; BOOL openedURL = NO; - if(browserBundleID) { - openedURL = [[NSWorkspace sharedWorkspace] openURLs:@[webURL] withAppBundleIdentifier:browserBundleID options:NSWorkspaceLaunchAsync additionalEventParamDescriptor:nil launchIdentifiers:NULL]; + if(browserApplicationURL) { + NSRunningApplication *urlOpeningApplication = [NSWorkspace.sharedWorkspace openURLs:@[webURL] withApplicationAtURL:browserApplicationURL options:NSWorkspaceLaunchDefault configuration:@{} error:nil]; + openedURL = nil != urlOpeningApplication; } if(!openedURL) { - openedURL = [[NSWorkspace sharedWorkspace] openURL:webURL]; + openedURL = [NSWorkspace.sharedWorkspace openURL:webURL]; } if(!openedURL) { NSLog(@"Unable to open URL %@", webURL);