Question

I made an App-Store app and would like to now make a tweak to let it run in the background using the VoIP UIBackgroundMode (keeping a socket open). The UIBackgroundModes are stored in the Info.plist file.

What would be the best way to give my app the VoIP UIBackgroundMode in Cydia? Would it be just a script that changes the app's Info.plist file (assuming this wouldn't break the app's signature and cause problems), or is there a function I could override with a tweak?

(I assume either way I could then make the minimal changes in my app's code necessary to use this UIBackgroundMode (that are executed only when the mode is actually set) and that Apple wouldn't detect this. I already submitted my app with the VoIP UIBackgroundMode active and was rejected by Apple. Upon removing it and the corresponding code the app was accepted.)

Was it helpful?

Solution

Yes, you can do this. It is simply a matter of modifying the app's Info.plist file (and maybe rebooting).

On a jailbroken device, modifying an App Store app's Info.plist file won't cause problems with the app signature.

I suppose you could try to find a way to do it programmatically, but honestly, I don't know that anything more than a script is required. You're just making a one-time modification, right? So, to me, it sounds like simply scripting this modification, and putting it in your "tweak" package's DEBIAN/preinst or DEBIAN/postinst file would be enough.

I have a few thoughts:

1. By default, your Info.plist file will be binary, which makes it harder to edit (via script). This can be worked around pretty easily by issuing this command prior to modifying the plist file:

plutil -convert xml1 Info.plist

from within your app's .app directory. This will leave Info.plist as a text file. Let me know if you don't have plutil, and I can track down which Cydia package contains it.

Note: you don't have to convert the plist back to binary after editing it. Text plists are valid, too.

2. You might chose to bundle the modified Info.plist with your Debian package, and simply replace the App Store version with the tweaked version. However, you have to worry about version numbers, and any other properties in that file that you update with new versions. In that case, simply copying one version of Info.plist into the .app directory might not work for all versions. So, you may need to detect which version you have, or search the plist file for

<key>UIBackgroundModes</key>

and insert the VOIP mode there. I'm not great with tools like sed and awk, and you can probably pose a simple scripting question here if you need help with that part ... I know iOS ... scripting ... less so :)

3. If your script needs to detect the app version in Info.plist for some reason, this command line will do that:

plutil -key CFBundleVersion Info.plist 

Note: while it's possible that there is a Private API to do this, I also wouldn't be surprised if there was not. I'm having a hard time envisioning a reason that Apple would see to do this, and if they don't see a reason to do it, there's probably no API (public or private). Normally, you decide on UIBackgroundModes at compile time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top