title: Load MKMapView in background and create UIImage from it (iPhone & iPad)
body: <p>I have a situation whereby I need a way of loading an MKMapView with several overlays. This map view shouldn't be shown onscreen, the only reason I require it to load is in order to create an image from the map for use elsewhere.</p>
  
  <p>I have had a look around online but I haven't had any luck with finding a solution to the problem. Please can someone help me out?</p>
  
  <p>Here is what I've tried so far (with no success)</p>
  
  <pre><code>// Load the map view
  Logs_Map_ViewController *mapViewController = [[Map_ViewController alloc] initWithNibName:@"Map_ViewController" bundle:nil];
  mapViewController.GPSCoordinatesToPlot = [someDictionary objectForKey:kGPSCoords];
  
  // Take a picture of the map
  UIImage *mapImage = [mapViewController convertMapToImage];
  NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(mapImage)];
  NSString *base64String = [imageData base64EncodedString];
  </code></pre>
  
  <p><strong>NOTE:</strong> It's really important that the app waits for the map to fully load (so that the image is created properly).</p>