且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

传输MKDirectionsRequest产生空错误Error Domain = MKErrorDomain Code = 5&“(null)& quot;

更新时间:2023-01-03 16:13:56

当前不支持路线选择路线(iOS 9).如您所见, MKDirectionsRequest 将返回空错误.

Routing directions for transit is currently not supported (iOS 9). MKDirectionsRequest will return a null error, as you observed.

这似乎仅直接记录在MapKit的标题中.看一下 Transit 类型的注释.

This only seems to be documented directly in MapKit's headers. Take a look at the comment for the Transit type.

//  MKDirectionsTypes.h

@available(iOS 7.0, *)
public struct MKDirectionsTransportType : OptionSetType {
    public init(rawValue: UInt)

    public static var Automobile: MKDirectionsTransportType { get }
    public static var Walking: MKDirectionsTransportType { get }
    @available(iOS 9.0, *)
    public static var Transit: MKDirectionsTransportType { get } // Only supported for ETA calculations
    public static var Any: MKDirectionsTransportType { get }
}