Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Appropriate Use of MapKit

DZone's Guide to

Appropriate Use of MapKit

· Mobile Zone
Free Resource

Get gorgeous, multi-touch charts for your iOS application with just a few lines of code.

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.

 

From http://www.peterfriese.de/appropriate-use-of-mapkit/

.Net developers: use Highcharts, the industry's leading interactive charting library, without writing a single line of JavaScript.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}