最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

objective c - How to open a URL with scheme and commands in macOS? - Stack Overflow

programmeradmin8浏览0评论

I am using Objective-C and using the openURL method to open a URL with scheme. This is the URL: ms-word:.docx

This works fine and opens the document in Microsoft Word app.

But when the URL consists of commands: ms-word:ofe|u|.docx, it is not opening the document in the Word app.

How to fix this?

Code:

void openUri(const char* uri) {
    NSString* nsUri = [NSString stringWithUTF8String:uri];
    NSURL* url = [NSURL URLWithString:nsUri];
   
    [[NSWorkspace sharedWorkspace] openURL:url];
}
发布评论

评论列表(0)

  1. 暂无评论