如何获取应用程序的 Bundle Id iOS UIA 自动化

发布于 2024-12-25 01:37:43 字数 25 浏览 2 评论 0原文

如何获取我所在应用程序的捆绑 ID?

How do I get the bundle Id of the app I am in ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦醒时光 2025-01-01 01:37:43

您可以使用:

[[NSBundle mainBundle] bundleIdentifier]

+ mainBundle "[r]返回当前应用程序可执行文件所在目录对应的 NSBundle 对象位于。”因此将返回应用程序包的 NSBundle 对象。

[-bundleIdentifier] 返回“接收者的包标识符,由捆绑包信息属性列表中的 CFBundleIdentifier 键。”

You'd use:

[[NSBundle mainBundle] bundleIdentifier]

+ mainBundle "[r]eturns the NSBundle object that corresponds to the directory where the current application executable is located." and hence will return an NSBundle object for the application bundle.

[- bundleIdentifier] Returns "[t]he receiver’s bundle identifier, which is defined by the CFBundleIdentifier key in the bundle’s information property list."

辞取 2025-01-01 01:37:43

以下是我在 UIA 脚本中获取应用程序的捆绑 ID 的方法:

//code to get bundle id
var target = UIATarget.localTarget();
var app_name = target.frontMostApp().bundleID();
UIALogger.logDebug(app_name);

Here is how I got the Bundle Id for my APP in the UIA Scripts:

//code to get bundle id
var target = UIATarget.localTarget();
var app_name = target.frontMostApp().bundleID();
UIALogger.logDebug(app_name);
水晶透心 2025-01-01 01:37:43

您可以从 plist 中找到捆绑包 id。右键单击应用程序文件,然后单击“显示包内容”。你会在那里找到一个 plist 文件。使用任何文本编辑器打开它,您将获得捆绑包 ID。

You can findle the bundle id from the plist. Right Click in the app file and click on "show package contents". You will find a plist file there. Open it with any text editor and you will get the bundle id.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文