Crashing on simulator target 5.1 with MapKit
Closed this issue · 3 comments
Get the following error whenever initializing a MKMapView
with showsUserLocation = true
on simulator targeting 5.1.
'uri.rb:4:in 'decode_www_form:': undefined method 'split' for nil:NilClass
I guess Google Maps uses that method to resolve user location. It works fine on 6.0 since MKMapView uses Apple Maps and does not call the above method anymore.
Question are
- Should fix it by checking null string?
- Or, should not monkey patch URI class?
Wow, that sucks! I'd rather not mutilate the class names (URI
-> WSURI
) to assuage the Objective-C runtime, but I don't see any other choice.
If you hack up the gem to do that, does it work?
I modified the method to check empty string and it works, though I don't think it is the solution.
I prefer separate class or utility methods rather than monkey patching core ruby/objc classes unless RubyMotion has a way to conditionally compile source code based on environment.
Finally got a chance to sit down with this one. Looks like Google Maps in 5.1 sends a Content-Type of application/x-www-form-urlencoded
with a HTTP body that is decidedly not URL-encoded. The URI class chokes on this because it's expecting a String.
This issue is fixed in 0.3.7 by not handling requests at all in dev mode. The mismatched Content-Type/body handling is fixed in master.
Thank you for bringing this to my attention.