Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    The Download: How AI really works, and phasing out animal testing

    November 17, 2025

    Deep Network Troubleshooting: An Agentic AI Solution

    November 17, 2025

    Today’s NYT Connections: Sports Edition Hints, Answers for Nov. 17 #420

    November 17, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»ios – Apple mapkit route function dose not works in China
    iOS Development

    ios – Apple mapkit route function dose not works in China

    big tee tech hubBy big tee tech hubOctober 12, 20250182 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – Apple mapkit route function dose not works in China
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I’m developing an iOS app using MapKit to calculate travel times between two coordinates.
    Everything works perfectly when I test with coordinates in the US, Japan, or Hong Kong if my network is outside mainland China.

    However, when my device (or simulator) is connected to a mainland China network and always fails with: “Directions Not Available“

    Some test result:
    Hong Kong → Hong Kong: ✅ works

    Hong Kong → Shanghai: ✅ works

    Shanghai → Hong Kong: ✅ works

    Japan (Tokyo → Tokyo): ❌ fail

    US (New York → New York): ❌ fail

    struct TravelTimeCalculator {
        static func calculateTravelTime(
            from: CLLocationCoordinate2D,
            to: CLLocationCoordinate2D
        ) async throws -> TimeInterval {
            let sourcePlacemark = MKPlacemark(coordinate: from)
            let destPlacemark = MKPlacemark(coordinate: to)
    
            let request = MKDirections.Request()
            request.source = MKMapItem(placemark: sourcePlacemark)
            request.destination = MKMapItem(placemark: destPlacemark)
            request.transportType = .automobile
    
            let directions = MKDirections(request: request)
            let response = try await directions.calculate()
            guard let route = response.routes.first else {
                throw NSError(domain: "No route found", code: -1)
            }
            return route.expectedTravelTime
        }
    }
    
    @MainActor
    struct TravelTimeView: View {
        @State private var travelTime: String = "Calculating..."
    
        var body: some View {
            VStack {
                Text(travelTime)
                    .font(.title2)
            }
            .task {
                do {
                    // Example: Tokyo Station → Shibuya Station
                    let from = CLLocationCoordinate2D(latitude: 35.6811441, longitude: 139.7644865)
                    let to   = CLLocationCoordinate2D(latitude: 35.6580382, longitude: 139.6990609)
                    
                    let seconds = try await TravelTimeCalculator.calculateTravelTime(from: from, to: to)
                    let minutes = Int(seconds / 60)
                    travelTime = "🚗 Estimated \(minutes) min"
                } catch {
                    travelTime = "❌ Route not available"
                    print("Route error: \(error.localizedDescription)")
                }
            }
        }
    }
    

    Test all kind of source / dest combination…



    Source link

    Apple China dose function iOS MapKit route works
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    The Download: How AI really works, and phasing out animal testing

    November 17, 2025

    ios – UserDefaults doesn’t store its value

    November 16, 2025

    ios – How to implement native Tab Bar search (.searchable) for a Dictionary view in SwiftUI?

    November 15, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    The Download: How AI really works, and phasing out animal testing

    November 17, 2025

    Deep Network Troubleshooting: An Agentic AI Solution

    November 17, 2025

    Today’s NYT Connections: Sports Edition Hints, Answers for Nov. 17 #420

    November 17, 2025

    ZnO Nanoparticles with 2 % Silver: A Game-Changer for Sensing

    November 17, 2025
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    The Download: How AI really works, and phasing out animal testing

    November 17, 2025

    Deep Network Troubleshooting: An Agentic AI Solution

    November 17, 2025

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2025 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.