Hello I trying to imeplement Sign in With apple on Desktop version(include macOS).
So, I request HTTP url that 'https://appleid.apple.com/auth/authorize?client_id=com.gcp2.crossplay.pe&nonce=xprodse8n2i&redirect_uri=https://www.google.com/testaaaa&response_mode=query&response_type=code'.
On macOS not showing apple id webpage, just show native UI like bellow.
My WKNavigationDelegate dosen't response when click after cancel button.
(void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;
(void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation;
(void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error;
(void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error;
(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation;
is any way handle this situation?
Post
Replies
Boosts
Views
Activity
I asked simmiar question : https://developer.apple.com/forums/thread/657252
And I read this document
https://stackoverflow.com/questions/62203978/why-my-arguments-are-being-blocked-when-running-a-shell-command/62205890#62205890
https://developer.apple.com/documentation/foundation/nstask
https://developer.apple.com/documentation/foundation/process
swift code could pass argument but objective c was not.
Purpose : try to open other application (.app) and pass argument (on C++ project).
how to Check : on Terminal ps ax | grep (appName)
Swift
let appPath = "/System/Applications/Utilities/Terminal.app"
let process = Process()
process.executableURL = URL(fileURLWithPath: "/usr/bin/open")
process.arguments = ["-a",
appPath,
"-n",
"--args",
"Open",
"From",
"Playground"
]
do{
try process.run()
}
catch {
}
Result
sangpan-2:~ sangpan$ ps ax | grep Terminal
87252 ?? S 0:00.46 /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal Open From Playground
98889 ?? S 0:03.28 /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
87356 s004 S+ 0:00.00 grep Terminal
ObjectiveC
NSString *appPath = @"/System/Applications/Utilities/Terminal.app";
		NSTask *task = [[NSTask alloc] init];
task.executableURL = [NSURL fileURLWithPath:@"/usr/bin/open"];
task.arguments = [NSArray arrayWithObjects:@"-a", appPath,
@"-n",
@"--args",
@"Open",
@"From",
@"Playground"
, nil];
NSError* Error = nullptr;
@try{
auto Result = [task launchAndReturnError:&Error];
if ( !Result )
{
NSLog(@"LAUNCH RESULT...?");
}
NSLog(@"LAUNCH success?");
} @catch (NSException* e){
NSLog(@"%@ FAIL?",task.executableURL);
}
Result
sangpan-2:~ sangpan$ ps ax | grep Terminal
87498 ?? S 0:00.42 /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
98889 ?? S 0:03.65 /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
87566 s004 S+ 0:00.00 grep Terminal
I need ObjectiveC solution for using on C++ project
Is it bug? or wrong usage? or is exist other way
// pass arguments Not Working
let url = NSURL(fileURLWithPath:
"/Volumes/DATA/Dev/cppPlayground/cmake-build-debug/cppPlayground"
, isDirectory: false) as URL
let configuration = NSWorkspace.OpenConfiguration()
var aStr = [String]()
aStr.append("1st")
aStr.append("2nd")
configuration.arguments = aStr
NSWorkspace.shared.openApplication(at: url,
	 configuration: configuration,
	 completionHandler: nil)
https://developer.apple.com/documentation/appkit/nsworkspace/3172700-openapplication
I try to open another cpp app that has main method ' int main(int argc, char **argv) '
and pass arguments.
but it was failed.
app was open successful but arguments was empty.
// Working But deprecated.
let task = Process()
task.arguments = ["test test", "2nd Argument", "3rd"]
task.launchPath = "/Volumes/DATA/Dev/cppPlayground/cmake-build-debug/cppPlayground"
task.launch()
this code was work. but available macOS 10.0–10.13.
is there something wrong?