我有一个大约有100个地址的列表。我想使用CLGeocoder Class和geocodeAddressDictionary或geocodeAddressString方法为每个地址获取CLPlacemarks列表。我不希望应用程序每次启动时都执行此操作(因为地址永远不会更改且需要互联网)。我如何静态存储100个CLPlacemark对象的列表,以便每次应用程序启动时加载?
NSError *error;
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Addresses" ofType:@"json"];
NSURL *localFileURL = [NSURL fileURLWithPath:filePath];
NSData *contentOfLocalFile = [NSData dataWithContentsOfURL:localFileURL];
NSDictionary *addresses = [NSJSONSerialization JSONObjectWithData:contentOfLocalFile
options: NSJSONReadingMutableContainers
error:&error];