Add GameKit key to your plist info file (Error)

I have a button "Add GameKit key to info plist file" in the "Features" tab. What does it mean?

Here is a screenshot:

+3


source to share


2 answers


Fix Gamekit Info.plist http://i.stack.imgur.com/zVUev.png

Just add an item under "Required Devices" in your Info.plist.

From the documentation:



Enable this switch if your app requires (or specifically disallows) Game Center (iOS 4.1 and newer).

More info here: https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

+8


source


I needed to do this from the command line (in CI). This is how I did it.

# make a copy of the Info.plist
cp Info.plist before.plist

# open xcode and hit Fix issue button
# compare the results
diff Info.plist before.plist

      

result

<       <string>gamekit</string>

      

More details



cat Info.plist | grep gamekit --context=3

      

returns this:

<key>UIRequiredDeviceCapabilities</key>
<array>
    <string>armv7</string>
    <string>gamekit</string>
</array>

      

Thus, the following snippet with plistbuddy can be used to do the same as the command line button:

# Adds UIRequiredDeviceCapabilities item to Info.plist
# || true prevents command line from failing if key already exists
/usr/libexec/PlistBuddy -c "Add :UIRequiredDeviceCapabilities array" Info.plist || true

# Add <string>gamekit</string> to array (at index 1) in Info.plist
# considering index 0 is already there and contains armv7
# Running Add multiple times will append a new line each time
# Here, we do it only if not already present
if grep -q "<string>gamekit</string>" Info.plist; then
    echo gamekit already present
else
    /usr/libexec/PlistBuddy -c "Add UIRequiredDeviceCapabilities:1 string gamekit" Info.plist
fi

      

+1


source







All Articles