01、概念
setting是可以在外部的设置或者app 内部设置一些东西供用户进行选着(test)
02、创建方法
To add a Settings bundle to your Xcode project:
Choose File > New > New File.
Under iOS, choose Resource, and then select the Settings Bundle template.
Name the file Settings.bundle.
03、Root.plist 的相关属性
Text field 可以进行编辑的文本框
Title 一个只读的描述信息
Toggle switch switch on/off
Slider 滑动条
Multivalue 各种类型让用户进行选择
Group 一组可选项
Child pane The child pane type lets the user navigate to a new page of preferences
04、在测试环境只限制在测试环境或者Pre环境的时候配置setting
if [ "Release" != "${CONFIGURATION}" ]
then
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' "${SRCROOT}/Loan/Resources/Supporting Files/Settings.bundle" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
5、使用的方法
#if DEBUG
NSString * setUrl = [[NSUserDefaults standardUserDefaults]stringForKey:@"debug_url_perference_Multi"];
if (setUrl == nil) {
setUrl = @"Developer ULR";
}
#else
NSString * setUrl = @"release URL";
#endif
debug_url_perference_Multi 是在setting当中的字段
6、实现思路
通过脚本进行配置,如果是开发环境将setting 添加到项目中,如果非开发环境则不会把Setting关联到项目,可以支持测试手动输入或者选择baseURL进行测试,setting设置完毕后将App 切掉后新启动