I am trying to use the new iOS7 MKMapSnapshotter to generate a static map image. Whenever my app needs a map, I call the following:
MKMapSnapshotter *snapshotter = [[[MKMapSnapshotter alloc] initWithOptions:theOptions] autorelease];
dispatch_queue_t aQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
DebugLog(@"Snapshotter allocated %@ and run on queue %@", snapshotter, aQueue);
[snapshotter startWithQueue:aQueue completionHandler:^(MKMapSnapshot *snapshot, NSError *error) {
DebugLog(@"Snapshotter completion block %@", snapshotter);
// perform selector on main thread to set self.imageView.image = shanpshot.image;
}
In most cases this is working great. However sometimes, it seems like the device gets overloaded with requests for maps and then it stops rendering. In my log file I will see the first log statement about the "Snapshotter allocated" but never see the "Snapshotter completion block" message.
Is it possible that my requests are never executed off of the dispatch queue?
Has anyone ever had this problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…