Can I programmatically flip Info.plist values ​​while my application is running?

I'm interested to use the keys SBUsesNetworkand UIRequiresPersistentWiFiin my application; however, I would like to enable them only when using a specific set of controllers. Is there a way to programmatically flip these key values ​​while the application is running?

+5
source share
5 answers

You cannot change the contents of your package while you work; you do not have the right to write to this directory. I'm not sure there is a way to do exactly what you want.

+6
source

, info.plist NSDictionary NSBundle :

NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];

mutableCopy NSDictionary . NSDictionary, info.plist, , .

app.plist , (, , , ), .

+3

Info.plist. , Apple , .

0

I do not think this will work. [NSBundle mainBundle] has a pointer to a specific infoDictionary. Even if you take a mutable copy, NSBundle will not know anything about our new plist. Has anyone else tried?

0
source

Info.plist is nothing more than a dictionary. Therefore, it can be edited.

0
source

All Articles