Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MKMapView framwork hasn't the relief google-map type in MKMapType declaration, but it works [closed]

i was trying to use a MKMapView, and i wanted to show/change the kind of map which google offers. We all know that on web sites we can use normal-roads type, hybrid type, satellite/photo type and, more recently, also the relief type.

this last is the one i'd like to use. I had no problem to insert it in a UIWebView + HTML + standard google API, but for many reasons now i'd prefer use it with a MKMapView. But... surprise:

"it seems" we couldn't use tat type of map...

reading in Apple MKMapView Class Reference:

MKMapType

The type of map to display.

enum {
   MKMapTypeStandard,
   MKMapTypeSatellite,
   MKMapTypeHybrid
};

where 0 is for MKMapTypeStandard

1 is MKMapTypeSatellite

and of course 2 is MKMapTypeHybrid...

so we are officially allowed to use just those 3 kind of maps, not the relief type, it seems it doesen't exist at all in the apple framwork...

but i'm curious and so i tried this:

myMKMapView.mapType = 3; // a number not officially declared

and it works perfectly, the apple framweork asks to google the right type of map and then it shows it in my view, both in simulator and iPhone device.

so, that's my question:

Do you think I could use it anyway even if it's not "officially" declared in apple documents? Would Apple reject my app to use it's framework this way?

thanks in advance,

luca

like image 689
meronix Avatar asked Oct 11 '22 14:10

meronix


1 Answers

I'm sure Apple would reject your app if they knew you were doing it as they are quite clear that you can only use documented features. I know they have tools which detect calls to undocumented methods and use of private frameworks but whether that extends to checking the value of a property when it's set, I'm not sure.

What I am sure though is that this creates fragile code. If Google introduces other map types and Apple decides to support them all in a future SDK update there's no guarantee that the relief type will remain as 3. Also what if Apple adds a check to this property so that in a future iOS release setting it to 3 will throw an exception? Your app will break for anyone that upgrades their OS and you will be forced to use another map type which may upset your users as the functionality is changing. That's just two examples of changes out of your control that could break this for your users.

In summary, could you use this: Yes, but Apple may reject your app and the only way to find out if they will or not is to do it. You'll also have to stay on your toes to ensure future iOS updates don't break your code.

like image 194
Dolbz Avatar answered Oct 15 '22 11:10

Dolbz