问题
MKMapSnapshotter seems to use up to 2GB of RAM when in the simulator, and triggers memory warnings and hangs my app for a very long time on the device. I'm not sure what part of my settings is causing this.
This huge usage occurs when retrieving multiple image simultaneously, but even retrieving multiple images one after the other seems to use frankly huge amounts of RAM, 600MB at peak, and fully occupies the CPU, using up to 190%. I've tried removing all other logic, not even saving the images after they're requested, and the huge RAM & CPU usage still occurs.
This cannot be intended. There must be something I'm not setting, to cause this runaway resource hogging. Here's my options code:
MKMapSnapshotOptions* options = [MKMapSnapshotOptions new];
options.region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(self.lat.doubleValue, self.lng.doubleValue), MKCoordinateSpanMake(0.01, 0.01));
options.scale = 2.0;
options.size = CGSizeMake(300, 44);
options.showsBuildings = NO;
MKMapSnapshotter* snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options];
[snapshotter startWithCompletionHandler:^(MKMapSnapshot *snapshot, NSError *error) {
// even if I do nothing in here, it still goes crazy
}];
What am I missing here?
来源:https://stackoverflow.com/questions/24994232/mkmapsnapshotter-uses-incredible-amounts-of-cpu-ram