Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test ios version without bubblewrap

Tags:

ios

rubymotion

I'd like to open maps on ios6 by usine MKMapItem but I'd also like fallback using google maps for older ios versions...

I have no Idea to do this on rubymtion without BubbleWrap cause Device.ios_version return me an error

I want to this this on iOS6 :

address_dictionnary = ({kABPersonAddressStreetKey: @party.place.street, kABPersonAddressCityKey: @party.place.city,kABPersonAddressZIPKey: @party.place.postal_code})
place = MKPlacemark.alloc.initWithCoordinate(@coords, addressDictionary: address_dictionnary)
mapItem = MKMapItem.alloc.initWithPlacemark(place)
mapItem.name = "#{@party.name}"
options = ({
   MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving
})
mapItem.openInMapsWithLaunchOptions(options)

And this on older versions :

url = "http://maps.google.com/maps?saddr=#{@party.place.location[1]},#{@party.place.location[0]}&daddr=#{@party.place.location[1]},#{@party.place.location[0]}"
App::open_url(url)

Thanks for your help


And then when I do the correct test : When I do the test and I run it on IOS 5.1 I have this error

dyld: Symbol not found: _MKLaunchOptionsDirectionsModeDriving

This is my code :

if Utils.older_than_ios6?
  url = "http://maps.google.com/maps?saddr=#{@party.place.location[1]},#{@party.place.location[0]}&daddr=#{@party.place.location[1]},#{@party.place.location[0]}"
  App::open_url(url)
else
  address_dictionnary = ({kABPersonAddressStreetKey: @party.place.street, kABPersonAddressCityKey: @party.place.city,kABPersonAddressZIPKey: @party.place.postal_code})
  place = MKPlacemark.alloc.initWithCoordinate(@coords, addressDictionary: address_dictionnary)
  mapItem = MKMapItem.alloc.initWithPlacemark(place)
  mapItem.name = "#{@party.name}"
  options = ({
     MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving
  })
  mapItem.openInMapsWithLaunchOptions(options)
end
like image 311
Benjamin Athlan Avatar asked May 18 '26 22:05

Benjamin Athlan


1 Answers

By checking the source for Device.ios_version, you can see that it returns UIDevice.currentDevice.systemVersion. So this should do the trick !

like image 86
ksol Avatar answered May 21 '26 12:05

ksol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!