I am interested in using the SBUsesNetwork
and UIRequiresPersistentWiFi
keys in my application; however, I would like to enable them only when using a certain set of view controllers. Is there a way to programmatically flip those key values while the application is running?
If you just want an empty info. plist file, then just select "New File..." on the "File" menu in XCode. In the "New File" window you pick "Other" on the left hand and then "Property List" on the right hand. Save this answer.
The Info. plist file is by default located in the root folder of your application's bundle, it's derived from the {ProjectName}-Info. plist file in the Xcode project.
plist file. This plist contains information about your iOS project. It's distributed as part of your app's binary package, and iOS uses it for example to display your app's name on an iPhone's home screen.
The Info. plist file contains critical information about the configuration of an iOS mobile app—such as iOS versions that are supported and device compatibility—which the operating system uses to interact with the app. This file is automatically created when the mobile app is compiled.
You can't modify your bundle contents while running, you don't have write access to that directory. I'm not sure there's a way to do exactly what you want.
I know you can get your info.plist as an NSDictionary via NSBundle with the following:
NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
from there you could make a mutableCopy
of the NSDictionary
and set the values therein. When making queries to the keys you'll have to make sure to query the NSDictionary
and not your info.plist file, but it shouldn't be hard to encapsulate all of this into a class that handles both problems for you.
As for modifying your app's info.plist file directly there could be issues there (e.g, if you modify the file the code signing will fail and your app will be considered corrupt), though I'm not certain on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With