Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用我的大脑来对抗来自原始 cocos2d iOS 库的 cocos2d-x 的精彩 lib xport。
我想问的是如何在 safari 浏览器中打开网页链接?我不知道如何链接原始 objc 代码
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:]];
我曾尝试使用能够执行 shell 命令的 LUA 引擎,但我找不到启动它的 safari 应用程序路径。
谢谢,人们。
您无法获得其他应用程序的路径。但是,如果您使用 openURL: 调用以打开带有 http:// 域的 URL,那么 Safari 将打开它。你试过吗?你得到什么结果?
更新:警告:我不是坐在可以测试它的机器前。
NSURL * url = [NSURL URLWithString:@"http://stackoverflow.com"]; [[UIApplication sharedApplication] openURL: url];
这应该是所有需要的。UIKit 将切换到 Safari 并浏览到提供的 URL。