19

From this old question: What's the difference between "bundle display name" and "bundle name" in cocoa application's info plist

It points to the official docs, which say:

CFBundleName

CFBundleName (String - iOS, OS X) identifies the short name of the bundle. This name should be less than 16 characters long and be suitable for displaying in the menu bar and the app’s Info window. You can include this key in the InfoPlist.strings file of an appropriate .lproj subdirectory to provide localized values for it. If you localize this key, you should also include the key “CFBundleDisplayName.”

Can anyone tell how to show this name in iOS?

I was never able to show this value in my iPhone.

Community
  • 1
  • 1
Ryan
  • 10,041
  • 27
  • 91
  • 156

7 Answers7

28

It doesn't look to me like CFBundleName shows anywhere to the user, on iOS. I believe I've seen documentation for Mac OS X (which obviously iOS inherits a lot of legacy infrastructure from), that says that the Bundle Name is used for something else ... I think it might have been the name in the upper Menu bar, or the lower Dock bar. Neither thing exists in iOS, of course.

I also found this Stack Overflow answer, which is now quite old (but with quite a few upvotes). This answer claims that CFBundleName would be the name of the folder that the app is stored in. So, for example, CFBundleName = HelloWorld should produce

+- HelloWorld.app
    - HelloWorldApplication

If the Executable Name was set to be HelloWorldApplication. However, I just built a simple program and ran it on iOS 5.0, and the .app folder was not named equal to CFBundleName. So, if it ever worked that way, it doesn't seem to any more.

I have seen quite a few references that say that CFBundleName should be left set to ${PRODUCT_NAME} in Xcode, which is what I always do. Not as a technical limitation, but as an Apple review criterion, I've also seen people claim that CFBundleDisplayName must be closely related to CFBundleName. For example, it's ok if it's a shortened version of CFBundleName, but that they might reject the app if it's unrelated altogether.

I also checked the listing in Settings.app, and in iTunes, and I didn't see the Bundle Name either of those places.

So, to answer your question, I don't believe this variable is visible to the user (on iOS).


Update: I have not, however, checked whether or not any accessibility features might speak this name anywhere.

Also, this SO answer claims that CFBundleName will be the name used in the iTunes App Store URL for your app. But, see @tc.'s comment/example URL below ...


Update 2: per @honus's comment below, one unusual scenario where CFBundleName can be shown to the user is if your app has no entry for CFBundleDisplayName in its Info.plist file. In that case, CFBundleName will be shown under the app icon in SpringBoard.

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207
  • 1
    Having worked with apps whose target/PRODUCT_NAME/CFBundleName were codenames, I'm pretty sure they're never displayed anywhere "user-visible". The most obvious occurrences are in crash logs or the console log (if the user's installed Xcode/iPCU), though this may just be the executable filename, and obviously the app .ipa itself if the user unzips it. *Generated* App Store URLs use the app name as it appears on the App Store (but is [ignored by itunes.apple.com](https://itunes.apple.com/us/app/THE_APP_NAME_IS_UNUSED/id284417350?mt=8)). – tc. Jun 07 '13 at 18:29
  • 1
    I'm pretty sure CFBundleName is the name that will show up for the app on Springboard if you have no CFBundleDisplayName set. – honus Nov 06 '13 at 01:48
  • @honus, thanks for the info. You are indeed correct. Not sure that this is a common scenario, but it's certainly good to know. Answer updated ... again :) – Nate Nov 06 '13 at 09:46
  • 4
    I love Apple documentations. They are so good that people have to come here to explain what they mean. If there were no forums like SO we would be screwed. – Duck Aug 20 '14 at 19:29
  • Just to confirm this: I wrote an app for my Mom's birthday, and it was my second try, so I called the project MomApp2. That is the product name, and by implication, the bundle name. But the user _never_ sees that name! The bundle display name (Diabelli) is set manually in the Info.plist, and so is the name that appears at the app store (Diabelli's Theme). – matt Jan 17 '15 at 03:28
  • 2
    CFBundleName is used in WatchKit apps. It is shown in Apple Watch app on the phone. – kolyuchiy Apr 28 '15 at 13:15
  • 5
    On iOS it is displayed during Google Sign-In as `"${CFBundleName}" name Wants to Use "google.com" to Sign In". This is system dialog, view hierarchy debugger doesn't show it, but I don't know which iOS API does GoogleSignIn framework invoke. – Sergii Rudchenko Feb 24 '18 at 23:45
  • @SergiiRudchenko correct, it is also used on iOS when asking Facebook SDK to login. I believe it is Safari which presents the dialog. – Anders Emil Mar 11 '19 at 09:11
9

It's not well-documented, but CFBundleName is displayed to the user in the permission dialog displayed by ASWebAuthenticationSession.

ASWebAuthenticationSession Dialog Example

robmathers
  • 3,028
  • 1
  • 26
  • 29
0

You can access those keys like this.

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]

Where infoDicitonary is A dictionary, constructed from the bundle's Info.plist file. There you can find this sort of information about your App. NSBundle

Note: You can check the actual key by opening the App-info.plist file and right clicking anywhere then selecting the option Show Raw Keys/Values.

ohr
  • 1,717
  • 14
  • 15
  • Hi, my question is: If I set this value in the info.plist, how does it mean for normal user? Where they can find this value? – Ryan Aug 28 '12 at 16:08
  • This only returns the non-localised values, you can use `[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]` if you want to get the localised value. https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/AccessingaBundlesContents/AccessingaBundlesContents.html#//apple_ref/doc/uid/10000123i-CH104-123093 – Mark Ingram Nov 03 '14 at 15:05
0

CFBundleName IS used, when localizing a MacOS Cocoa App, in the Mac OS MenuBar as the Application Name (right from the File Menu). So it DEFINITELY has a meaning. Don't know, if it is used and shown somewhere else. But better not leave it out, when localizing your app!

Bernd
  • 189
  • 9
0

On macOS it is used as a means to decide if the application's name should be localized in the Finder. If the actual name of the bundle (of course extended by '.app') matches CFBundleName, Finder will show its localized display name instead. However, a user might rename the App to something he finds more appropriate and in that case, macOS needs a way to tell if the name was customized.

Bachsau
  • 1,213
  • 14
  • 21
-1

If you open your info.plist file by context clicking it in the project tree and selecting "Open As > Source Code", you'll see the XML representation of the plist. By default, these two keys have the same value, so you could access either one.

<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>

To actually grab the values, you can use this SO post as a guideline: How to display the current project version of my App to the user? Just replace the CFBundleVersion key with CFBundleDisplayName.

In essence:

NSString *displayName = [[[NSBundle mainBundle] infoDictionary] 
                                          valueForKey:@"CFBundleDisplayName"];
Community
  • 1
  • 1
Matt Long
  • 24,438
  • 4
  • 73
  • 99
  • Hi, my question is: If I set this value in the info.plist, how does it mean for normal user? Where they can find this value? – Ryan Aug 28 '12 at 16:07
  • A normal user won't see it unless you display it. You have to decide where you want to display the name. You can add a label to a view or you can display it in a navigation controller. The point is that *you* have to code that. It won't show up anywhere automatically except under the home screen icon. – Matt Long Aug 29 '12 at 00:12
  • After some testing, the one which display under the home screen icon is `CFBundleDisplayName`, not `CFBundleName` – Ryan Aug 29 '12 at 05:08
-4

Bundle name is the name of the actual application bundle on the file system.

Bundle display name is the caption of the application icon that the user will see on either their iOS device or the caption of the icon on OSX.

deleted_user
  • 3,817
  • 1
  • 18
  • 27
  • As I mentioned in my other answer, I've heard people say that, too, but I just built an iOS 5 app, changed **Bundle Name**, and it definitely did not name the `.app` directory with that Bundle Name. – Nate Sep 05 '12 at 10:15
  • theres a reason you heard other people say it. – deleted_user Sep 05 '12 at 11:40
  • I just built the app. It doesn't use the name for the .app folder on iOS 5. If there's a reason, then the reason is that people can be unreliable sources of information. – Nate Sep 05 '12 at 18:02
  • try archiving your app, then exporting it and check the result – deleted_user Sep 05 '12 at 18:58
  • I don't know what you mean by **Export**, but if I **Archive** from Xcode, it shows up in Organizer with a name other than `CFBundleName` (assuming I changed CFBundleName, of course). If I click on the archive and **Show in Finder**, the .xcarchive file is also **not** named per CFBundleName. If I **Distribute**, and save it as an .ipa, and then unzip that .ipa, the .app folder inside is not named per CFBundleName. – Nate Sep 06 '12 at 11:23
  • That's what I just said I did. See the big bolded word **Archive** above? CFBundleName on an .app folder absolutely nowhere to be found. – Nate Sep 06 '12 at 11:30
  • stackmonster - you are wrong. i just tested and my results are the same as Nate's. – jsd Sep 07 '12 at 23:22
  • yeah Im wrong thats why my aps have the exact specified bundleName and bundle display name every time – deleted_user Sep 15 '12 at 08:25