如何测试没有bubblewrap的ios版本

时间:2012-10-05 13:39:35

标签: ios rubymotion

我想通过usine MKMapItem在ios6上打开地图,但我也想使用谷歌地图为旧版ios版本进行回退...

我没有想法在没有BubbleWrap的情况下在rubymtion上执行此操作导致Device.ios_version返回错误

我想在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)

这是旧版本:

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)

感谢您的帮助


然后当我做正确的测试时: 当我进行测试并在IOS 5.1上运行时出现此错误

dyld: Symbol not found: _MKLaunchOptionsDirectionsModeDriving

这是我的代码:

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

1 个答案:

答案 0 :(得分:5)

通过检查Device.ios_version的来源,您可以看到它返回UIDevice.currentDevice.systemVersion。所以这应该成功!