简体   繁体   中英

MKMapKit on iOS 6 and Google Maps on older devices

I'd like to show maps on iOS 6 by using MKMapItem but I'd also like to use Google Maps for older iOS versions.

When I test my solution 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

This link shows that MKLaunchOptionsDirectionsModeDriving is available only on iOS6+.

And just to be sure, did you add MapKit to the list of frameworks in your Rakefile ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM