How to get Bundle Id of your app iOS UIA automation

swathy valluri picture swathy valluri · Jan 5, 2012 · Viewed 36.7k times · Source

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

Answer

Tommy picture Tommy · Jan 5, 2012

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."