这是我的 Obj-C 代码:
NSMutableArray *staffNamesArray = [[[NSUbiquitousKeyValueStore defaultStore] arrayForKey:@"staffNamesArray"] mutableCopy];
NSInteger indexSelected = [oStaffPickerView selectedRowInComponent:0];
[staffNamesArray replaceObjectAtIndex:indexSelected withObject:textField.text];
[[NSUbiquitousKeyValueStore defaultStore] setArray: staffNamesArray forKey:@"staffNamesArray"]; // save it to the cloud
[[NSUbiquitousKeyValueStore defaultStore] synchronize];
IndexSelected 为 0;textfield.text = @“凯利”。
出于某种原因,staffNamesArray 永远不会被设置。为什么?