title: MapKit Tile Overlay broken in iOS8
body: <p>I have this code to implement OSM in my app <em>over</em> default Apple one:</p>
  
  <pre><code>dispatch_async(dispatch_get_main_queue(), ^{
      NSString *template = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
      MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
      overlay.canReplaceMapContent = YES;
      [self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];});
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id&lt;MKOverlay&gt;)overlay {
  if ([overlay isKindOfClass:[MKTileOverlay class]]) {
      return [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay];
  }
  else return nil;
  }
  </code></pre>
  
  <p>In iOS 7 it was fine, but now it returns multiple times and the map is not loaded at all:</p>
  
  <pre><code>&lt;Error&gt;: ImageIO: CGImageSourceCreateWithData data parameter is nil
  </code></pre>
  
  <p>How can I fix it? I tried to refactor my code, so first chunk of code is now:</p>
  
  <pre><code>dispatch_queue_t fetchTiles = dispatch_queue_create("fetcher", NULL);
  dispatch_async(fetchTiles, ^{
      NSString *template = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
      MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
      overlay.canReplaceMapContent = YES;
      dispatch_async(dispatch_get_main_queue(), ^{
          [self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];});});
  </code></pre>
  
  <p>But this doesn't seem to fix the problem.</p>