Posts

Post not yet marked as solved
0 Replies
744 Views
I have created the user defaults with suite Name like below without enabling app groups in the Signing & capabilities.    NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.mycompanyname.share"]; // Storing the value here   [defaults setValue:@"This is value1" forKey:@"key1"];   [defaults synchronize]; // Retrieving value here for key1   NSString *value = [defaults valueForKey:@"key1"];   NSLog(@"This data stored for key1 is : %@", value); The data is stored successfully and got the logs while retrieving key1:  2021-05-14 16:35:34.031941+0530 demo[16478:224183] This data stored for key1 is : This is value1 So everything is good till now. Now comes the problem where I enable the app groups for my project in Signing & capabilities selected the name group.com.mycompanyname.share and reinstalled the app  When I tried to get the stored value using the below code the data user defaults data is lost getting null:   NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.mycompanyname.share"]; // Retrieving value here for key1 NSString *value = [defaults valueForKey:@"key1"]; NSLog(@"This data stored for key1 is : %@", value); Got the logs like this (null) data for key1 : 2021-05-14 16:36:24.174784+0530 demo[16512:225476] This data stored for key1 is : (null) Please help me on this how to fix this issue?
Posted
by sunil58.
Last updated
.