Editing (augmenting) info.plist

  1. ‹ Older
  2. 5 years ago

    Norman P

    29 Jul 2015 Xojo Inc, Xojo Pro Seeking work. npalardy@great-w...

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

  3. Edited 5 years ago

    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.

  4. Norman P

    29 Jul 2015 Xojo Inc, Xojo Pro Seeking work. npalardy@great-w...

    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

  5. Just tried that and unfortunately there was no change.

  6. Norman P

    29 Jul 2015 Xojo Inc, Xojo Pro Seeking work. npalardy@great-w...

    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

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

  8. Norman P

    29 Jul 2015 Xojo Inc, Xojo Pro Seeking work. npalardy@great-w...

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

  9. Greg O

    29 Jul 2015 Xojo Inc scout.galaxy.barn
    Edited 5 years ago

    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.

  10. Greg O

    29 Jul 2015 Xojo Inc scout.galaxy.barn

    From the Defaults man page:

    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.

  11. Norman P

    29 Jul 2015 Xojo Inc, Xojo Pro Seeking work. npalardy@great-w...

    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

  12. Greg O

    29 Jul 2015 Xojo Inc scout.galaxy.barn

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

    /usr/libexec/PlistBuddy
  13. 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 OLone and @Norman P!

  14. Norman P

    29 Jul 2015 Xojo Inc, Xojo Pro Seeking work. npalardy@great-w...
    Edited 5 years ago

    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"

  15. 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.

  16. 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" )
  17. Thank you both for your help.

  18. Greg O

    30 Jul 2015 Xojo Inc scout.galaxy.barn

    @Jason K 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" )

    Shouldn't that be App + "/Contents/Info.plist" ?

  19. @Greg OLone Shouldn't that be App + "/Contents/Info.plist" ?

    For OSX yes. But iOS doesn't have a contents folder inside of the bundle to organize everything so it's not needed here.

  20. 4 years ago

    Michel B

    15 Oct 2016 Testers, Xojo Pro
    Edited 4 years ago

    @Jason K 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" )

    Well, it appears it no longer works :(

    I created a script with exactly the above, placed it after the build, info.plist is not modified.

    For the time being, I have extracted info.plist from a debug build, and from a build, and will use a copyfile to place the modified versions in the bundle.

  21. last year

    I was using the information in this thread to try to make my own mods to my app's plist file, and discovered a couple of gotchas along the way which may possibly be of interest to others following in the same footsteps:

    (1) My app’s name had spaces in it, and looking at the Xojo build step command, whilst CurrentBuildLocation produces an escaped path, it looks as though CurrentBuildAppName is not escaped. So I had to do it myself, with the crude but seems to work addition of

    CurrentBuildAppName.ReplaceAll( " ", "\ " )

    (2) As pointed out above, if using this on OSX, don't forget to add the Contents folder to your path.

    (3) I had to add in the ".app" extension to the path

    Putting these together with the example GameKit command above, I found this worked for me (on OSX):

    Dim App As String = CurrentBuildLocation + "/" + CurrentBuildAppName.ReplaceAll( " ", "\ " )

    call DoShellCommand("/usr/libexec/PlistBuddy -c ""Add :UIRequiredDeviceCapabilities:0 string gamekit"" " + App + ".app/Contents/Info.plist" )

or Sign Up to reply!