我在“功能”标签上有一个“为您的信息plist文件添加GameKit键”错误。那是什么意思?
答案 0 :(得分:8)
Gamekit修复Info.plist http://i.stack.imgur.com/zVUev.png
只需在 Info.plist 中的必需的设备功能中添加项目。
来自文档:
如果您的应用需要(或明确禁止)游戏中心(iOS 4.1及更高版本),请包含此密钥。
答案 1 :(得分:1)
我需要从命令行(在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>
因此可以使用以下代码段与https://jsfiddle.net/rntshg76/4/一起执行与命令行中的按钮相同的操作:
# 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