3

I have an "Add the GameKit key to your info plist file" error on the Capabilities tab. What's that supposed to mean?

Here is a screenshot:

3
  • What did it do when you clicked "Fix issue"?
    – rebello95
    Aug 26, 2014 at 3:19
  • @rebello95 i didn't clicked it yet! i want to find out what is this first Aug 26, 2014 at 3:22
  • 2
    Look at your info.plist file, click "Fix issue", and see what changes.
    – rebello95
    Aug 26, 2014 at 3:23

2 Answers 2

8

Gamekit fix Info.plist https://i.stack.imgur.com/zVUev.png

Just add and item in Required device capabitilities in your Info.plist .

From documentation:

Include this key if your app requires (or specifically prohibits) Game Center (iOS 4.1 and later.)

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

1

I needed to do this from command line (in a CI). Here's how I did.

# 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>

In more details

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

returns this:

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

So one could use the following snippet with plistbuddy to do the same as the button from command line:

# 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.