[英]How to get Bundle Id of your app iOS UIA automation
如何获取我所在应用程序的软件包ID?
You'd use: 你用的是:
[[NSBundle mainBundle] bundleIdentifier]
+ mainBundle
"[r]eturns the NSBundle object that corresponds to the directory where the current application executable is located." + mainBundle
“[r] eturns NSBundle对象,它对应于当前应用程序可执行文件所在的目录。” and hence will return an NSBundle
object for the application bundle. 因此将返回应用程序包的NSBundle
对象。
[ - bundleIdentifier
] Returns "[t]he receiver's bundle identifier, which is defined by the CFBundleIdentifier key in the bundle's information property list." [ - bundleIdentifier
]返回“[t]接收者的包标识符,它由包的信息属性列表中的CFBundleIdentifier键定义。”
Here is how I got the Bundle Id for my APP in the UIA Scripts: 以下是我在UIA脚本中获取APP的Bundle ID的方法:
//code to get bundle id
var target = UIATarget.localTarget();
var app_name = target.frontMostApp().bundleID();
UIALogger.logDebug(app_name);
You can findle the bundle id from the plist. 您可以从plist中找到包ID。 Right Click in the app file and click on "show package contents". 右键单击应用程序文件,然后单击“显示包内容”。 You will find a plist file there. 你会在那里找到一个plist文件。 Open it with any text editor and you will get the bundle id. 使用任何文本编辑器打开它,您将获得包ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.