Search code examples
iosiphonexcode-ui-testing

How to get App name in UITesting swift 4 iOS


I tried to get my app name in UITesting. I tried the code below:

let appName = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as! String

But it gives me the nil value result.


Solution

  • Are you sure, that you've set Display name in your Info.plist file? Just set this name in Project settings or in Info.plist:

    enter image description here

    enter image description here