I have this weird issue:
I call the parent app with openParentApplication:reply:
as normal.
It is nicely doing its job getting some data from the internet using async NSURLRequests
but when I want to get a map image using MKMapSnapshotter
(still in the parent app) its completion block is never called.
MKMapSnapshotter *snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options];
[snapshotter startWithCompletionHandler:^(MKMapSnapshot *snapshot, NSError *error) {
NSLog(@"completion handler is called"); //this never called
};
I tried to call with: snapshotter startWithQueue:
on dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)
or dispatch_get_main_queue()
etc. but nothing seems to work.
If I call the same code directly from WKInterfaceController
or from the parent app it works just fine.
I don't think you can call/use
MKMapSnapshooter
the way you are wanting to. When you useopenParentApplication
to make the request, it is opening your parent app in background mode andMKMapSnapshooter
requires Foreground mode to deliver the final image.as per Apple docs: