Peter Friese

Developer Advocate / Mobile Developer / Public Speaker

Appropriate Use of MapKit

| Comments

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?

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

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:

1
2
3
4
5
6
7
8
- (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:

1
2
3
4
5
6
7
8
9
10
11
- (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.

Comments