Is MultiPolygon overlay support going to be integrated with SwiftUI?
I have made a post on here previously without a reply :(
Any suggestions on how to display multi-polygons within MapKit for SwiftUI(https://developer.apple.com/documentation/mapkit/mappolygon)?
At the moment it is not supported and only supported by MapKit for UIKit(https://developer.apple.com/documentation/mapkit/mkmultipolygon).
Post
Replies
Boosts
Views
Activity
Edit: The issue was resolved. It's back up.
I was streaming the new MapKit Places video, and it suddenly stopped. It's now missing from the Developer app and website. Is this intentional?
I have a map tool app in MacOS which needs request Location permission to show MapUserLocationButton.
During development, the request for permission can pop up for the first run in my mac, but when it comes to the Apple review(Submission ID: 11f52f82-1d54-481a-9eed-880521fda2b3), they never see that.
My mac is Macbook air M2 2022, 14.5 (23F79).
Of course, enable App Sandbox - Location and fill up the Privacy - Location When in Use Usage Description
Code:
//
// LocationManager.swift
//
import MapKit
@Observable
class LocationManager: NSObject {
static let shared = LocationManager()
private let manager = CLLocationManager()
var isReady: Bool = false
var showingAlert = false
// var location: CLLocationCoordinate2D?
var isAuthorized: Bool {
#if os(macOS)
.authorized == manager.authorizationStatus
#else
.authorizedWhenInUse == manager.authorizationStatus
#endif
}
private override init() {
super.init()
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyBest
setup()
}
private func setup() {
isReady = isAuthorized
#if os(macOS)
if CLLocationManager.locationServicesEnabled() {
checkStatus()
} else {
showingAlert = true
}
#else
checkStatus()
#endif
}
private func checkStatus() {
switch manager.authorizationStatus {
case .notDetermined:
manager.startUpdatingLocation()
#if os(macOS)
#else
manager.requestWhenInUseAuthorization()
#endif
#if os(macOS)
case .restricted, .denied:
showingAlert = true
case .authorizedAlways, .authorizedWhenInUse:
manager.startUpdatingLocation()
#else
// case .authorizedWhenInUse:
// manager.requestLocation()
#endif
default:
break
}
}
}
extension LocationManager: CLLocationManagerDelegate {
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
isReady = isAuthorized
guard isReady else { return }
// manager.requestLocation()
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
// location = locations.last?.coordinate
}
}
My team and I would like to develop a mechanism that collects the user’s location a few times per day, to detect when the user travels to a different country, for the user’s convenience. The app is very likely going to be opened very rarely. The user would of course be made aware of why collecting the location a few times a day is desired - namely, saving them the effort of having to remember to open the app every time they travel.
My question is the following: given that the app would rarely be interacted with, what is the best strategy for collecting the location? The goal is to handle scenarios where the OS might avoid sending location events or notifications to the app. I imagine that the backend might need to intervene and send the occasional push notification to remind the user to open the app from time to time.
There are 3 strategies that I’m aware of:
LocationManager’s startMonitoringSignificantLocationChanges
Scheduling BGAppRefreshTasks
Using silent push notifications scheduled by the server. Ideally, using a location push service extension
Keeping in mind the “Background execution demystified” WWDC session, documentation, and other threads, I concluded the following:
The first idea is probably the least suitable, since it probably requires the app to be opened often, and the location updates would not be sent by OS if the app has been terminated from the app switcher.
The second approach would also suffer from infrequent use and termination.
The third approach seems not to be affected as much by infrequent usage. I understand that the 3rd strategy might also lead to the OS omitting to wake up the app when it has been terminated by the user.
How would you implement this mechanism?
I've started getting reports of this today and I am able to replicate it on my end but looking to see if anyone else can verify or if it's possibly regional to me (Canada).
In Apple Maps (iOS or macOS), if you search a latitude and longitude -- for example: "49.110,-112.110" and search, it centers on the location as it always has and shows the "Directions" button. When you tap the directions button, I get "A route can't be shown because of a problem connecting to the server.".
Alternatively, if you pass the coordinate in via Apple Maps URL (https://maps.apple.com/?daddr=49.110,-112.110) it will route but the route is no longer to those specific coordinates, Apple Maps alters them to some nearest known entity (in this case, the RM of Warner County). If you compare the suggested route end destination with the search results for specifically entering the coordinates, you will see they are different locations and mapping routes are not actually taking you to the coordinates anymore.
In the last photo attached, the arrow points to where "49.110,-112.110" is actually located which tapping the "Directions" button cannot figure out a route because of a server issue. If you pass it in via URL, it changes the destination coordinates and begins a route quite a ways away from the intended coordinate.
The problem started happening either this morning or last night.
Can anyone else confirm this happens to them?
Thanks,
Mike
I consistently get an error that the Map initailizer I'm using is deprecated and I should use a MapContent builder instead. Various errors such as "'MapAnnotation' was deprecated in iOS 17.0: Use Annotation along with Map initializers that take a MapContentBuilder instead." or "'init(coordinateRegion:interactionModes:showsUserLocation:userTrackingMode:annotationItems:annotationContent:)' was deprecated in iOS 17.0: Use Map initializers that take a MapContentBuilder instead."
The problem in my code seems to be located here:
import SwiftUI
import MapKit
struct ContentView: View {
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 34.0522, longitude: -118.2437),
span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5)
)
@State private var restaurants: [Restaurant] = []
var body: some View {
Map(coordinateRegion: $region, annotationItems: restaurants) { restaurant in
// This uses the updated Annotation API
MapAnnotation(coordinate: restaurant.coordinate) {
VStack {
Text(restaurant.restaurantName)
.bold()
.foregroundColor(.white)
.padding(5)
.background(Color.black.opacity(0.75))
.cornerRadius(10)
.fixedSize()
Image(systemName: "mappin.circle.fill")
.foregroundColor(.red)
.font(.title)
}
}
The errors persistently occur in the lines immediately below var body: some View {
I've been stuck on this for two days now. Any help would be greatly appreciated.
We have an app that has been using iBeacons and Geofences for 10+ years. While I cannot state when it started, we're seeing sporadic delays of hours to receive iBeacon "didExitRegion" event. I can prove this out on my iPhone running iOS 17.4.1 by setting up both a Geofence and an iBeacon in the same physical location.
Yesterday, I have a several hour gap with no iBeacon events, but successfully see Geofence events. Then, an hour+ after leaving the Geofence, I get multiple didExitRegions from the same iBeacon (all without touching the app). Then this morning, everything again is working great.
It "feels" like the phone stops delivering entry and exit events for the Bluetooth iBeacon for some period of time. Then, it resumes monitoring by first providing old event that were not delivered to us in real time. It's not atypical for me to see a didExitRegions event that should happen around 5pm that instead happens in the middle of the night.
So far, I have not noticed this behavior for our app running on iOS 16.4.1. We're currently testing other versions of iOS to see if we can pinpoint when it started. I have a full battery so we've ruled out power saving mode. Bluetooth is on with all permissions of course. We are still receiving Geofence updates so we must have available background time.
Is there any known issue in iOS 17+ that would explain this behavior? Or, is there any Feedback/Radar to explain it? Known issue?
Good afternoon, I'd like to get detailed information about the price usage of the Apple Map in my app in IOS (Swiftui for Iphone and Ipad). I'd like to establish a future price for the app subscription and to do that I need to obtain the precise prices for opening the map, consulting Map items, creating routes, the price of each consulting, and any other price that is related to the map usage process.
I have been searching for this information and it has not been easy to find answers. I appreciate it if I could get the information.
Best regards,
Marcello Lima
Hey, I've developed a new audio-based navigation technology for my Master's project at Imperial College London. The main aim of it is to take away the need for an annoying voice based prompt to interrupt your music ("Turn left in 300 yards"). Instead I've created a more natural interaction where the listener's music is binaurally spatialised to provide less annoying directional information.
I've tested the product with many users and the feedback has been really positive! I just wondered whether anyone knew someone at Apple that I could have a chat with about this technology? I think it would work great if it was linked to Apple Maps, especially now with the integration of head-tracking into the Airpod Pro's.
We are developed app based on driver behaviour using location and sensor data.
It's working in both background and foreground using region monitoring.
Its consume more battery comparing other apps like. Its reduce 5% for every 5 to 10 mins of duration.
We are using for our app functionality
Location (Always) - every 1sec
Sensor - Accelerometer - every 20data for 1sec
Background - Region monitoring
Time Action - 1sec for 20time
Any possible way to reduce battery consuming? If any please suggest your points.
Thanks in advance for your comments.
Hi there,
I am trying to develop a country guessing game using MapKit and GeoJSON data. I have verified that my data creates the outline of the country properly using other methods, but I run into an error where the map clips and does not show portions of the countries or islands when zooming at certain levels of the map. I receive the warnings in the terminal "Mismatching number of indices, indexCount: 30, triangulatedIndexCount: 27" and "Triangulator failed to fully triangulate polygon: (0.1296, 0.303328), (0.108053, 0.296605), (0.0671644, 0.289883), (0.0586311, 0.281121), (0.0397156, 0.27289), (0.0323911, 0.262393), (0.0610489, 0.260732), (0.102507, 0.284671), (0.140053, 0.292602), (0.133511, 0.291167), (0.137707, 0.293659), (0.138489, 0.29872)" I am not sure what these tuple values are, or how to fix the errors, as I have adjusted my data (removing duplicate coordinates, refreshing the map, etc). How am I able to counteract these warnings, or at least get a sense of what they are asking?
How do GPS lat and lon get written to .MOV files on iPhones? Is it programmed to export the coordinates as soon as you press record, when you press end, some other time?
If you are recording and walking or driving what location will the GPS affix to the file? I thank you all so much for your time and help.
It appears that this is the file that the location gets written to? com.apple.quicktime.location.ISO6709
I have a driving tracking app I'm working on that properly starts tracking and logging location when the app is in the foreground or background. I use a buffer/queue to keep recent locations so when a trip ramps up to driving speed I can record that to work back to the start location just before the trip starts. This works great, however, in background mode when the user does not have the app open it will record locations but not until a significant location change is detected. The buffering I do is lost and the location only starts tracking several hundred yards or more after the trip has started. Does anyone have any suggestions or strategies to handle this chicken and the egg scenario?
My MacBook Air M2 system version macOS Sonoma 14.5 Beta (23F5049f)
The error occurred: from the end of March 2024 to today (April 8, 24)
Problem: The system positioning information is seriously wrong, including but not limited to: time zone, Safari, map app, weather app, search app... (PS. The positioning is correct when using Google Chrome and Google Maps, but it is still wrong when using Google Maps on Safari)
Background:
I came to Germany from mainland China at the end of March.
The Apple ID region I use is Germany.
The location of my iPhone and Apple Watch can be refreshed to Germany normally, and several of my AirTags have been refreshed to Germany.
Tried but failed:
I searched for some bash commands to try to clear and clear the cache of the map app and system location information.
rm -rf ~/Library/Containers/com.apple.Maps
rm -rf ~/Library/Application\ Support/com.apple.findmy
sudo rm -rf /Library/Caches/com.apple.GeoServices
sudo rm -rf /Library/Caches/com.apple.locationd
defaults delete com.apple.locationd.plist
Turn off location services in System Settings > Privacy and Security, shut down and restart the phone, and then turn the service back on.
Turn my VPN on and off.
Clear my network information.
Since there are many files saved, the restore operation is not planned.
我的MacBook Air M2 系统版本macOS Sonoma 14.5 Beta版(23F5049f)
错误发生时间:2024年3月底到今天(24年4月8日)
问题:系统定位信息严重错误,包括但不限于:时区、Safari、地图app、天气app、查找app... (PS.使用Google Chrome浏览器与Google Maps时定位正确,Safari使用Google Maps仍然错误)
背景:
我从3月底从中国大陆来到欧洲德国。
我使用的Apple ID地区是德国的。
我的iPhone和Apple Watch定位能正常刷新到德国,且我几个AirTag已经刷新到德国。
尝试但都未成功:
我搜索了一些bash命令尝试清除、清空地图app和系统位置信息的缓存。
rm -rf ~/Library/Containers/com.apple.Maps
rm -rf ~/Library/Application\ Support/com.apple.findmy
sudo rm -rf /Library/Caches/com.apple.GeoServices
sudo rm -rf /Library/Caches/com.apple.locationd
defaults delete com.apple.locationd.plist
关闭系统设置>隐私与安全中的定位服务,关机重启,再重开这项服务。
开关我的VPN。
清除我的网路信息。
由于保存的文件较多,不打算进行还原操作。
Hello dear when i use geolocator after i'll get this error
Could not build the precompiled application for the device.
Error (Xcode): Undefined symbol: OBJC_CLASS$_LocationServiceStreamHandler
Error (Xcode): Undefined symbol: OBJC_CLASS$_PositionStreamHandler
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
Error launching application on iPhone.
and didn't app running so plz guide i'm a too much upset
I'm trying to create an app where the user guesses their location, so I'd love to hide the road name and country in the MKLookAroundView. I have already seen some apps pull this off and I'm wondering how to do it. I tried this, but it's not working:
struct LookAroundView: UIViewControllerRepresentable {
@Binding var isExpanded: Bool
@Binding var initialScene: MKLookAroundScene?
func makeUIViewController(context: Context) -> MKLookAroundViewController {
let lookAroundViewController = MKLookAroundViewController()
lookAroundViewController.isNavigationEnabled = true
lookAroundViewController.showsRoadLabels = false // I thought this would hide road labels but it doesn't
lookAroundViewController.pointOfInterestFilter = .excludingAll
lookAroundViewController.badgePosition = .bottomTrailing
if let initialScene = initialScene {
lookAroundViewController.scene = initialScene
}
return lookAroundViewController
}
func updateUIViewController(_ uiViewController: MKLookAroundViewController, context: Context) {
uiViewController.isNavigationEnabled = isExpanded
uiViewController.showsRoadLabels = false //This was my last idea
}
}
I am facing issue in changing the initial coordinates of map from (0,0) to any other coordinates, before going to the map screen. So that map will start from the desired coordinates , not from (0,0).
Hello there,
Mainland china user(s) have trouble accessing MapKitJS, keeps returning HTTP 401 unauthorized for https://cdn.apple-mapkit.com/ma/bootstrap?apiVersion=2&mkjsVersion=5.77.35.
The same valid JWT perfectly works for users rest of the world.
May i know is there any special handling needed for accessing mapkitJS on web from mainland china compared to rest of the world.
Advises are highly appreciated.
Hi
I want to inquire about the data returned from CoreLocation update and whether it is accurate.
I am attempting to retrieve the local address in Japan based on the postal code, and I have observed differences in the returned data.
When calling the information retrieval function with the postal code 3360042, the returned data is as follows:
Locality: さいたま市
SubLocality: 南区
Corresponding to Japan Post:
https://www.post.japanpost.jp/cgi-zip/zipcode.php?pref=11&city=1111080&id=38748
the displayed information on the website includes "Locality + SubLocality".
When calling the information retrieval function with the postal code 1350064, the returned data is as follows:
Locality: 江東区
SubLocality: 青海
Corresponding to Japan Post japan post:
https://www.post.japanpost.jp/cgi-zip/zipcode.php?pref=11&city=1111080&id=38748
the displayed information on the website only includes "Locality" not includes SubLocality.
Is it possible that CoreLocation has been updated? The current data seems to deviate from the design of our application.
Please provide me with a solution to determine when to use "Locality + SubLocality" versus just "Locality" to obtain the local address.
Thank.
This problem cannot be solved and the review is not approved