Post

Replies

Boosts

Views

Activity

transportType .transit does not work
hi, does someone encounter this problem, this is sample code : let request = MKDirections.Request() request.source = MKMapItem(placemark: startPlacemark) request.destination = MKMapItem(placemark: endPlacemark) request.transportType = .transit // .transit does not work I want to make a route with two point(startPlacemark and endPlacemark ), when I give request.transportType the value of **.transit ** ,I found it not work, ps: .automobile .walking works well , my Xcode version is 16 .
0
0
110
Oct ’24
bicycle mode to navigate
MKLaunchOptionsDirectionsModeDefault MKLaunchOptionsDirectionsModeDriving MKLaunchOptionsDirectionsModeWalking MKLaunchOptionsDirectionsModeTransit when I am using the mapkit navigation, I only see the 4 modes, but can not find the mode of bicycle, so how can I find the enum of using bicycle to navigate by bicycle ,than you!~ Xcode version is 16.
0
0
148
Oct ’24
can I specify the transit mode
aoubut MKLaunchOptionsDirectionsModeKey, when I use MKLaunchOptionsDirectionsModeTransit as a mode in my code to call function openMaps ,the apple map app launches,it has 4 mode ,subbay or ferry,bus etc,so how can I specify the subway to transit before apple map app launch,so that I do not need to select on the map app,just specific subway in my own app, then the map app auto select the subway transit navigation。now it shows two much usless route。
0
0
180
Oct ’24
how to show subway exit in the mapkit mapview
mapView.showsTraffic=true mapView.showsScale=true mapView.showsCompass=true mapView.showsUserLocation=true mapView.showsBuildings=true mapView.showsLargeContentViewer=true hi,guy,please help to see this problem,thankyou,the mapkit api support some showsfunction,but I can not find how to show the exit of subway in my own app,but the map app of appple shows the exit of the subway,so how can I show the exit of the subway stations by using mapkit
1
0
157
Oct ’24
can not find placemark when search by japanese character
when I using MKLocalSearch by japanese character let request = MKLocalSearch.Request() request.naturalLanguageQuery = "東京涩谷地下鉄駅" request.region = mapView.region let search = MKLocalSearch(request: request) search.start {....} ,it can not return the placemark, shows Error : The operation couldn’t be completed. (MKErrorDomain error 4.). Failed to parse font key token: hiraginosans-w6 how can I fix this problem,thankyou! import UIKit import MapKit class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var resultsTableView: UITableView! var mapView: MKMapView! var searchResults = [MKMapItem]() override func viewDidLoad() { super.viewDidLoad() mapView = MKMapView(frame: CGRect(x: 0, y: 220, width: view.bounds.width, height: view.bounds.height - (tabBarController?.tabBar.frame.size.height ?? 0))) mapView.showsScale = true mapView.showsCompass = true mapView.showsScale = true mapView.showsUserLocation = true mapView.userTrackingMode = .follow mapView.delegate = self view.addSubview(mapView) let selectedCoordinate = CLLocationCoordinate2D(latitude: 35.661777, longitude: 139.704051) // some Coordinate near 東京涩谷地下鉄駅 let selectedLocation = CLLocation(latitude: selectedCoordinate.latitude, longitude: selectedCoordinate.longitude) let coordinateMKCoordinateRegion = MKCoordinateRegion(center: selectedLocation.coordinate, latitudinalMeters: 50000, longitudinalMeters:50000) mapView.setCenter( selectedLocation.coordinate, animated: true) mapView.setRegion(coordinateMKCoordinateRegion, animated: true) drawCircle(radius: 5000, center: selectedLocation.coordinate) searchForStation() } func drawCircle(radius: CLLocationDistance, center: CLLocationCoordinate2D) { let circle = MKCircle(center: center, radius: radius) mapView.addOverlay(circle) } func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { if let circleOverlay = overlay as? MKCircle { let circleRenderer = MKCircleRenderer(circle: circleOverlay) circleRenderer.fillColor = nil circleRenderer.strokeColor = UIColor.blue circleRenderer.lineWidth = 2.0 return circleRenderer } return MKOverlayRenderer(overlay: overlay) } func searchForStation() { print( "searchForStation" ) let request = MKLocalSearch.Request() request.naturalLanguageQuery = "東京涩谷地下鉄駅" // request.region = mapView.region let search = MKLocalSearch(request: request) search.start { [weak self] (response, error) in guard let self = self else { return } guard let response = response, let mapItem = response.mapItems.first else { print("Error : \(error?.localizedDescription ?? "Unknown error").") return } for mapItem in response.mapItems { print( "mapItem.placemark =",mapItem.placemark) // hope to get 東京涩谷地下鉄駅placemark,the value of latitudeand longitude) } } } }
2
0
189
4w
how to show different launch screen for different language
I am making a swift app supporting multi language ,showing proper language ui according user's phone setting language, I want to launch different screen (showing different image, boot-en.jpg, boot-ja.jpg) according language,i created two LaunchScreen files ,LaunchScreen-en.storyboard and LaunchScreen-ja.storyboard and localize them ,and add a different UIImage to them, then create two InfoPlist.strings file with congfiging ."UILaunchStoryboardName" = "LaunchScreen_en"; // "UILaunchStoryboardName" = "LaunchScreen_ja";// and then **config info.plist ** with UILaunchStoryboardName LaunchScreen above all steps ,build and run,hope to see launch screen showing boot-ja.jpg when phone's language is Japanese, showing boot-en.jpg when phone's language is English, but it shows black screen, how to fix this problem, thank you.
1
0
174
2w