简体   繁体   中英

How to set a class in my own framework to be editable

I am going to create a framework to connections; There are the number of settings related to project such as domain and port, and I want to use this value in my framework;

What is the best solution to do this? (I don't want to put these settings in project -> Build Settings)

I can't say this is a best way, just one option.

In your framework, an initial function should be set ( or a class ). for example:

@interface Util
+(void)initialSetting:(NSDictionary*)parmas
@end

then put your settings into a plist file. (you can also use system setting to hold these params)

example.plist.

After App run, then you can read settings from plist file, then feed them in the initial function.Just like this:

NSString * filePath=[[NSBundle mainBundle] pathForResource:@"example.plist" ofType:nil];
NSDictionary * dic=[NSDictionary dictionaryWithContentsOfFile:filePath];
[Util initialSetting:dic]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM