Editing (augmenting) info.plist

In order to use Game Center in an app, that app needs to have the “gamekit” key added to its info.plist file. According to the release notes on this feature:

Any items USER plists create that duplicate keys the IDE creates will be over written by the IDE (basically you can't replace or augment entries the IDE creates) Only top level keys are dealt with (keys that are immediately children of PLIST > DICT in the Plist XML format)
In order to add this key so that the app works properly with Game Center it must be added to the UIRequiredDeviceCapabilities array which Xojo already creates with the “armv7” key. What is the best way to set the “gamekit” key in the info.plist file so that the app works correctly? Or do I need a feature request?

Thanks,
Jason

Would’nt that help ? https://forum.xojo.com/24288-gamekit-error-application-is-not-allowed-to-run-in-production

[quote=203148:@Jason King] Or do I need a feature request?
[/quote]
No need
See 38737

[quote=203209:@Norman Palardy]No need
See 38737[/quote]
Ok great! Is there another way to do this in the mean time while I wait for r3? Maybe with a post build script? I tried to make one similar to how Retina is enabled but it didn’t properly edit the plist.

post build using defaults write would be the way I’d try

I tried the following before with no success:

Dim App As String = CurrentBuildLocation + "/""" + CurrentBuildAppName Call DoShellCommand("/usr/bin/defaults write " + App + "/Info UIRequiredDeviceCapabilities -array gamekit armv7")

Maybe there was a problem with my post build script? I’ll be honest that my knowledge of defaults is very limited so that could be the problem.

Seems about right
The only thing I can think of that might affect this is the “domain” argument may need to actually be the full path to the plist including the plist extension

Just tried that and unfortunately there was no change.

try the command manually after you do a build in terminal to get the right command & syntax
once you have that the shell will be darned close to the same

I’ve been trying a variety of combinations and google searches for 45 minutes now haven’t been able to make any progress. I guess I’ll have to wait for someone who is more knowledgeable about using defaults to help me fix this.

What version of OS X are you on ?
That may be relevant

Defaults Write only works for plists in the preferences directory now. You’ve got to use plist buddy to modify a plist in a particular location.

From the Defaults man page:

[quote]WARNING: The defaults command will be changed in an upcoming
major release to only operate on preferences domains. General
plist manipulation utilities will be folded into a different
command-line program.[/quote]

There IS an alternative tool apple ships called PlistBuddy which might work better
The reason I say this is defaults has this small note
WARNING: The defaults command will be changed in an upcoming
major release to only operate on preferences domains. General
plist manipulation utilities will be folded into a different
command-line program.

so its possible that you ARE writing to a plist but its one IN your preferences dir and NOT the one you think your writing to

Keep in mind that PlistBuddy is not in the default path. On my machine it’s at:

/usr/libexec/PlistBuddy

OSX 10.10.4 so I think you are correct that it won’t work. I’ll look into PlistBuddy, thanks for the tip @Greg O’Lone and @Norman Palardy!

its in /usr/libexec/PlistBuddy

and it has a simpler command line interface

something like

/usr/libexec/PlistBuddy -c “Add :UIRequiredDeviceCapabilities: String gamekit” “… FULL PATH TO YOUR PLIST HERE”

Yeah I came up with the same thing you did but it doesn’t seem to work in a build script, only in terminal. Time to do some more digging.

Ok, for anyone else who may need this, the following works properly:

Dim App As String = CurrentBuildLocation + "/" + CurrentBuildAppName call DoShellCommand("/usr/libexec/PlistBuddy -c ""Add :UIRequiredDeviceCapabilities:0 string gamekit"" " + App + "/Info.plist" )

Thank you both for your help.