简体   繁体   中英

Settings.bundle not respecting app group on iOS simulator or device

I had been using standardUserDefaults until recently but decided to use shared app groups because I created a watch extension. I have set up an app group and also added the ApplicationGroupContainerIdentifier to the settings bundle.

I have spent hours on this and, even after reading many articles, I just can't get this to work. I am seeing that when I alloc my app group and print its contents, it has default values from standardUserDefaults .
All I am doing is [[NSUserDefaults alloc] initWithSuiteName: SUITE_NAME]] and then print its contents on the very next line.
I am puzzled by how it has values from my settings bundle. Moreover, when you edit the properties using the settings app, the settings in standardUserDefaults are changing but my app group values stay the same.

I see the same behaviour on the simulator and real device.

This turned out to be user error. There was a typo in the app group name as a result of the auto-correct feature. I did not realize it until I created a new app group.

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