目标C InfoPlist.strings已本地化-使用应用名称

时间:2018-08-13 13:40:04

标签: objective-c localization

我有一个$ {PRODUCT_NAME},以引用我所有目标的应用名称。我想在InfoPlist.strings中使用它,以便在CameraUsageDescription和其他描述中使用目标名称。

如何在字符串中使用它?

类似这样的东西:

/* Localized versions of Info.plist keys */

"NSLocationWhenInUseUsageDescription" = "Allows geolocation to send your location in the chat or know which institutions and services are near you";
"NSContactsUsageDescription" = "To be able to talk with the contacts who have ${PRODUCT_NAME} we need to access your agenda";
"NSPhotoLibraryUsageDescription" = 'Allows ${PRODUCT_NAME} to access the gallery to be able to send photos through the chat';
"NSCameraUsageDescription" = "Allows access to the camera to make a photo and send it";
"NSContactsUsageDescription" = "To be able to talk with the contacts who have ${PRODUCT_NAME} we need to access your agenda";
"NSPhotoLibraryAddUsageDescription" = "Allows access to save the images received by the chat";

1 个答案:

答案 0 :(得分:0)

您可以使用$(PRODUCT_NAME)进行引用。 info.plist中的应用名称。

例如:“ $(PRODUCT_NAME) requires camera permission.

它会像“ YourAppName requires camera permission.