检测您的可可快速应用程序正在运行的位置

编程入门 行业动态 更新时间:2024-10-20 11:44:38
本文介绍了检测您的可可快速应用程序正在运行的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试但无法找出是否有一种方法可以使用swift检测正在运行的.app文件的路径和名称

I'm trying but unable to find out if there is a way using swift to detect the path and name of the .app file that is running

ie if我的应用程序是selfupdater.app,它存储在〜username / applications中

ie if my app is selfupdater.app and its stored in ~username/applications

当selfupdater.app作为swift中的字符串变量启动时,如何获取此信息

how can i get this information when selfupdater.app is launched as a string variable in swift

推荐答案

这称为您的主捆绑包文件夹。

This is called your main bundle folder.

迅速3或更高版本

extension URL { var parentDirectory: URL? { return (try? resourceValues(forKeys: [.parentDirectoryURLKey]))?.parentDirectory } }

let bundleURL = Bundle.main.bundleURL if let path = bundleURL.parentDirectory?.path { print(path) }

更多推荐

检测您的可可快速应用程序正在运行的位置

本文发布于:2023-11-27 19:01:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639221.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:您的   可可   应用程序   正在运行   位置

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!