【问题标题】:Add the GameKit key to your info plist file (Error)将 GameKit 密钥添加到您的 info plist 文件(错误)
【发布时间】:2014-08-26 03:10:49
【问题描述】:

我在“功能”选项卡上出现“将 GameKit 密钥添加到您的信息 plist 文件”错误。这是什么意思?

【问题讨论】:

  • 当你点击“修复问题”时它做了什么?
  • @rebello95 我还没有点击它!我想先看看这是什么
  • 查看你的info.plist文件,点击“修复问题”,看看有什么变化。

标签: ios objective-c xcode cocos2d-iphone gamekit


【解决方案1】:

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

只需在 Info.plist 中的 Required device capabitilities 中添加和项目。

来自文档:

如果您的应用需要(或明确禁止)Game Center(iOS 4.1 及更高版本),请包含此密钥。

更多信息在这里: https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

【讨论】:

    【解决方案2】:

    我需要从命令行(在 CI 中)执行此操作。我就是这样做的。

    # 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
    

    结果

    <       <string>gamekit</string>
    

    更多细节

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

    返回这个:

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

    因此可以使用以下 sn-p 和 plistbuddy 来执行与命令行中的按钮相同的操作:

    # 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-28
      • 1970-01-01
      • 1970-01-01
      • 2012-09-05
      • 1970-01-01
      • 1970-01-01
      • 2022-10-20
      • 2012-05-26
      相关资源
      最近更新 更多