我尝试了下面的代码,它对我来说工作正常。也能够启动邮件应用程序。
//Note the below path is coming from bundle identifier of Mail APP
NSString *path=@"/Applications/Mail.app"
NSURL *mailURL = [NSURL URLWithString:path];
NSError *err=nil;
[[NSWorkspace sharedWorkspace] launchApplicationAtURL:mailURL
options:NSWorkspaceLaunchDefault
configuration: someData
error:&err];
但它在控制台上向我抛出了以下错误消息,它实际上意味着什么。如何解决以下问题。
CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: /Applications/Mail.app