简体   繁体   中英

Xcode - change bundle identifier but not product name

My bundle identifier has to match the one in the iOS dev portal:

com.mydomain.myappname

It seems the only way to do this in Xcode is to go to Targets, Build Settings, and change the Product Name to myappname. However, this also causes the app to be called "myappname" on the device home screen (under the icon). I know that has to able to be set differently. (I want "My App" to be displayed instead of "myappname"). Where do I set this?

You set this as the "Product Name" in the Build Settings in Xcode. You want to set your bundle identifier in the info.plist file for your app.

The bundle identifier in the Info.plist can contain placeholder variables such as ${PRODUCT_NAME}. These placeholder variables are replaced with their values from the build settings when the app is compiled. Use plutil to see the compiled version of the Info.plist in your .app bundle.

The "Bundle identifier" and "Bundle display name" are set in the info.plist file. The "Bundle display name" is what shows up by the app icon on the Home screen. They can use placeholder values such as ${PRODUCT_NAME} or ${PRODUCT_NAME:rfc1034identifier}, or you can set them explicitly. The "Product Name" is set in the Build Settings. You can first set the "Product Name" the way you want it, and then adjust or override the derived values by editing the info.plist file.

It sounds like what you want to do is set the Product Name to be "myappname", leave the Bundle identifier to be "com.mydomain.${PRODUCT_NAME:rfc1034identifier}", and then set the Bundle display name to be "My App".

What I did is put in the matching bundle identifier name at "Build Settings > Product Name". And then key in the actual App Name at the "Info > Bundle Display Name". Overwrite the ${PRODUCT_NAME} variable and key in the exact "My App". This do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM