Where CFBundleName is being used

19,227

Solution 1

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.

Solution 2

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

ASWebAuthenticationSession Dialog Example

Share:
19,227
Ryan
Author by

Ryan

Updated on June 09, 2022

Comments

  • Ryan
    Ryan almost 2 years

    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.

  • Ryan
    Ryan over 11 years
    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
    Ryan over 11 years
    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?
  • Matt Long
    Matt Long over 11 years
    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.
  • Ryan
    Ryan over 11 years
    After some testing, the one which display under the home screen icon is CFBundleDisplayName, not CFBundleName
  • Nate
    Nate over 11 years
    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.
  • deleted_user
    deleted_user over 11 years
    theres a reason you heard other people say it.
  • Nate
    Nate over 11 years
    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.
  • deleted_user
    deleted_user over 11 years
    try archiving your app, then exporting it and check the result
  • Nate
    Nate over 11 years
    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
    Nate over 11 years
    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.
  • jsd
    jsd over 11 years
    stackmonster - you are wrong. i just tested and my results are the same as Nate's.
  • deleted_user
    deleted_user over 11 years
    yeah Im wrong thats why my aps have the exact specified bundleName and bundle display name every time
  • tc.
    tc. almost 11 years
    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).
  • honus
    honus over 10 years
    I'm pretty sure CFBundleName is the name that will show up for the app on Springboard if you have no CFBundleDisplayName set.
  • Nate
    Nate over 10 years
    @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 :)
  • Duck
    Duck over 9 years
    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.
  • Adam McKee
    Adam McKee over 9 years
    This only returns the non-localised values, you can use [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] if you want to get the localised value. developer.apple.com/library/mac/documentation/CoreFoundation‌​/…
  • matt
    matt over 9 years
    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).
  • kolyuchiy
    kolyuchiy about 9 years
    CFBundleName is used in WatchKit apps. It is shown in Apple Watch app on the phone.
  • Sergii Rudchenko
    Sergii Rudchenko about 6 years
    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.
  • Anders Emil
    Anders Emil about 5 years
    @SergiiRudchenko correct, it is also used on iOS when asking Facebook SDK to login. I believe it is Safari which presents the dialog.
  • trapper
    trapper over 2 years
    Well done, very good find!
  • Taufik Nur Rahmanda
    Taufik Nur Rahmanda almost 2 years
    It's the right answer, yet it's a very bottom answer