MKMapSnapshotter 'completionHandler' not called on iPhone 6/6+

351 Views Asked by At

I'm developing app that works with MKMapSnapshotter API.
It makes snap shot of map with required region.
Code for it called from foreground app state and from main thread, like this:

MKMapSnapshotOptions* options = [[MKMapSnapshotOptions alloc] init];
options.region                = MKCoordinateRegionMake(locationCenter, span);
options.scale                 = UIScreen.mainScreen.scale;
options.size                  = size;

__block typeof(self) blockSelf = self;

MKMapSnapshotter* snapshooter = [[MKMapSnapshotter alloc] initWithOptions: options];

[snapshooter startWithCompletionHandler: ^(MKMapSnapshot* snapshot, NSError* error) {
    blockSelf.snapshot = snapshot.image;
}];

I noticed that on iPhone 6 and 6+ completion handler is never being called, tested on iOS 8 and 9.
In the iOS simulator, everything works as expected, tested with Xcode 7, iOS 8 & 9.
Any ideas - how to fix that?

1

There are 1 best solutions below

0
Artem Kislitsyn On BEST ANSWER

try this

__block __strong typeof(self) blockSelf = self