簡體   English   中英

有沒有辦法在Info.plist文件的其他地方引用CFBundleIdentifier?

[英]Is there a way to refer to the CFBundleIdentifier elsewhere in the Info.plist file?

對於我們的游戲,在Info.plist文件中,我們的CFBundleIdentifier設置為

<key>CFBundleIdentifier</key>
<string>com.sixminute.$(PRODUCT_NAME:rfc1034identifier)</string>

但是,對於Google Play登錄,我們需要CFBundleURLTypes的以下URL類型,

        <key>CFBundleURLName</key>
        <string>com.sixminute.$(PRODUCT_NAME:rfc1034identifier)</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>com.sixminute.$(PRODUCT_NAME:rfc1034identifier)</string>
        </array>

有什么方法可以代替$(BUNDLE_IDENTIFIER)或類似的方法動態引用CFBundleIdentifier

您可以按照以下步驟在目標屬性的XCode中定義用戶變量:

  1. 轉到目標應用的“構建設置”
  2. 選擇菜單“編輯器”->“添加構建設置”->“添加用戶定義的設置”
  3. 為每個配置命名變量(例如“ BundleId”)及其值

然后在您的plist文件中,您可以簡單地使用:

<key>CFBundleIdentifier</key>
<string>${BundleId}</string>

您不能稍后(或以編程方式)動態更新CFBundleIdentifier,而只能向其編譯時添加值。 如果您要引用其他內容,您的問題也不清楚。

BTW,CFBundleIdentifier和CFBundleURLName / CFBundleURLSchemes完全正交。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM