Skip to content

February 16, 2011

6

Appropriate Use of MapKit

Infinite Loop

I just had an app rejected because of violation of the Google Maps terms of service. While it certainly is kind of funny Apple rejects an app because you're violating Google's terms of service, I was wondering what in particular was wrong. At first sight, everything looked OK. Have a look at the following screenshot. It clearly violates Google's terms of service for Maps, but can you spot what is wrong?

Google Maps in your app - without Google Logo: you're doing it wrong!

What's wrong with this map?

Maybe you can better see what's wrong when I show you another screenshot, this time obeying the TOS:

Google Maps with logo: well done!

With logo: well done!

Can you spot the difference? It's the Google logo!

The reason why it is not shown in the first screenshot is that the bounds for the map are not set correctly. In the offending version of my app, I used a piece of code similar to this one:

 
- (void)viewDidLoad {
  [super viewDidLoad];
  mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
 
  mapView.showsUserLocation=TRUE;
  mapView.mapType=MKMapTypeStandard;
  [self.view addSubview:mapView];
}
 

Nothing wrong with it, but it lacks one essential line:

 
- (void)viewDidLoad {
  [super viewDidLoad];
  mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
 
  mapView.autoresizingMask =
    (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);	
 
  mapView.showsUserLocation=TRUE;
  mapView.mapType=MKMapTypeStandard;
  [self.view addSubview:mapView];
}
 

So, next time you write an app that contains Google Maps, make sure the Google logo is visible. You can get the full source code for this example on my GitHub page.

Thanks for reading this post. Follow me on twitter here to be notified about updates and other posts I write. Or, subscribe to my RSS feed here

Fork me on GitHub
  • http://twitter.com/oisin oisin

    I just went back to my iPhone app-in-progress and noticed no Google logo on the maps. Adding this resizing mask doesn’t make it appear – I better dig into it a bit more!

    • http://twitter.com/oisin oisin

      For my application, it turns out that just setting the resizing mask to be UIViewAutoresizingFlexibleHeight worked to bring the Google logo back onto the page.

      • http://www.peterfriese.de Peter Friese

        So you’re only using one of the style bits? Interesting – how does the structure of your view hierarchy look like?

    • http://www.peterfriese.de Peter Friese

      One reason less for Apple to reject your app :-) Actually, that’s the reason I wrote the post – to help people to avoid things you wouldn’t think about usually. It’s interesting to note that our ESE app had (and still has) the same issue. (Hm – do I run the risk of Apple pulling the ESE app now)?

  • http://twitter.com/allenweiss Allen Weiss

    Thank you..I’ve been looking around for quite awhile trying to find out why the logo wasn’t showing (my app was rejected for the same reason).

  • Rocky

    Thank you :)