简体   繁体   中英

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

For our game, in the Info.plist file, our CFBundleIdentifier is set as,

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

But then, for Google Play Sign in, we need the following URL Types in CFBundleURLTypes ,

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

is there any way we could instead reference the CFBundleIdentifier dynamically like $(BUNDLE_IDENTIFIER) or similar?

You can define user-variables in XCode in your target properties by following these steps :

  1. Go to "Build settings" of your target app
  2. Select Menu "Editor"-> "Add Build Setting" -> "Add User-Defined Setting"
  3. Name your variable (eg "BundleId") and its value for each configurations

Then in your plist file you can simply use :

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

you can not dynamically update CFBundleIdentifier later(or programmatically) and you can only add value to it compile time. Your question is also not clear, if you are referring something else.

BTW, CFBundleIdentifier and CFBundleURLName/CFBundleURLSchemes are completely orthogonal.

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