开发者

Change application settings through settings bundle while application is running IOS

开发者 https://www.devze.com 2023-03-20 14:22 出处:网络
I have written code in -(void)applicationWillEnterForeground:(UIApplication *)application , but my application is not detecting the change made in the settings bundle, new settings work when applicati

I have written code in -(void)applicationWillEnterForeground:(UIApplication *)application , but my application is not detecting the change made in the settings bundle, new settings work when application restart开发者_开发问答s, someone please help me how to make changes in application's settings while application is running


Try to -(BOOL)synchronize; the NSUserDefaults.


After setting the values in NSUserDefaults try calling [[NSUserDefaults standardUserDefaults] synchronize]; so that the values get written to disk.


in your applicationWillEnterForeground: methode after this line

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults], add this line

[defaults synchronize];

0

精彩评论

暂无评论...
验证码 换一张
取 消