简体   繁体   中英

Is it possible to change productName via xcconfig file in xcode?

I am setting below two parameters in Config.xcconfig file to fetch appDisplayName and bundle Identifier from config file. I did my code in xcconfig file as :

appDisplayName=myapp
appIdentifier=org.prince.myapp

Set in app- Info.plist file as

Bundle identifier = ${appIdentifier}
Bundle display name =${appDisplayName}

add it to project under configurations.

It is working fine as I have given myapp as display name it is showing in simulator/device as it is.

Lets come to the point. I want to know Is there any way to change PRODUCT_NAME variable value. I set PRODUCT_NAME=custom in configuration file but this doesn't seems to work.

在此输入图像描述

O yes, I have done it...

set PRODUCT_NAME=kat in Config.xcconfig file and place PRODUCT_NAME variable on

->Targets --> Build Setting -->Packaging --> Product Name as given below in screenshot

在此输入图像描述

看到这个图像

From here you can edit Bundle display name, bundle name. Double click on $[PRODUCT_NAME] then you will able to edit this.

If you want to changes PRODUCT_NAME for Localization, means if you want to change product name in different language according to device language then you can localize InfoPlist.strings file and add following in all language file -

    "CFBundleDisplayName" = "Your_Product_Name"; 
    "CFBundleName" = "Your_Product_Name";

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