繁体   English   中英

将GameKit键添加到info plist文件中(错误)

[英]Add the GameKit key to your info plist file (Error)

我在“功能”选项卡上有一个“为您的信息plist文件添加GameKit键”错误。 那是什么意思?

这是一个截图:

Gamekit修复Inf​​o.plist http://i.stack.imgur.com/zVUev.png

只需在Info.plist中添加所需设备功能的项目。

来自文档:

如果您的应用需要(或明确禁止)游戏中心(iOS 4.1及更高版本),请添加此密钥。

更多信息请访问: https//developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

我需要从命令行(在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>

因此,可以使用以下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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM