Hi everyone,
I’m building an iOS 18+ app in Xcode where Apple Maps is central. My goal is to start with the default Apple Maps experience (map view, search bar, pins, directions sheet, etc.) and then customize it for my project.
I tried coding it from scratch using MapKit and SwiftUI, but I wasn’t able to get full parity with the basic features of the Maps app.
My questions:
Is there any sample project, template, or reference that provides the default Apple Maps functionality (views + interactions) as a baseline?
Can I copy these into my Xcode project and then extend/customize them?
If not, what’s the recommended best practice to get as close as possible to the native Maps app before adding my own features?
Any guidance, sample code, or documentation links would be greatly appreciated.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have the following code snippet with a simple map and map reader that shows a pin on the map when the user selects a location
struct MapReaderTest: View {
@State private var loc: CLLocationCoordinate2D? = nil
var body: some View {
MapReader { proxy in
Map {
UserAnnotation()
if let loc {
Marker(coordinate: loc, label: { Text("Marker") })
}
}
.onTapGesture { position in
let position = proxy.convert(position, from: .local)
loc = position
}
}
}
}
This snippet compiles and works perfectly fine using Xcode version 16.4 building for iOS 18.0 and running on a device. This snippet also works for me when I build using Xcode 26 Beta and run in the canvas or simulator, however it does not work when I compile using Xcode 26 and run it on a physical device(I built and tested for both iOS 18.6 and iOS 26 Beta)
Has anyone else had a similar issue / have any ideas for work arounds?
Previously, when using AppDelegate, I was able to check the app’s launch options (launchOptions) to determine cases such as:
Location updates (UIApplication.LaunchOptionsKey.location)
Background push notifications (UIApplication.LaunchOptionsKey.remoteNotification)
However, after migrating to the SceneDelegate approach, launchOptions is no longer available — it always returns nil.
In my app, I need to branch the code depending on the launch options, but I can’t find a way to achieve this in the SceneDelegate environment.
👉 Is there a way to access launch options in SceneDelegate, similar to how it worked in AppDelegate?
Or, if that’s no longer possible, what would be the proper alternative approach?
Any guidance would be greatly appreciated.
Hello,
We are a software and hardware development company for the forestry and environmental sectors. We have been based in Quebec (Canada) for over 30 years now. Our Canadian market covers Quebec, Ontario, and the Maritime provinces in the east. We are currently expanding across Canada and into the northern United States. We are on Android platforms with several map and data entry applications.
To ensure the success of our expansion, we aim to become part of the Apple family, which is why we are contacting you today.
We have developed our own GNSS receiver to increase the location accuracy of our users. It uses Bluetooth BLE to communicate with mobile devices and a high-precision GPS that transmits its position using the NMEA protocol. We would like this device to be compatible with an iPhone/iPad. We have developed a mock location application in MAUI (multi-platform). Based on our interpretation of your documentation, we understand that the concept of mock location does not exist at Apple. How can we ensure that our Bluetooth GNSS device is compatible with your iPhone/iPad devices and that they can use the position of the Bluetooth device rather than the internal GPS of your devices?
We are a reseller for Juniper Systems, and we know that they have an app on the App Store that has the same features as our product.
https://junipersys.com/index.php/support/article/14709
We look forward to your follow-up and recommendations.
Hello,
We are a software and hardware development company for the forestry and environmental sectors. We have been based in Quebec (Canada) for over 30 years now. Our Canadian market covers Quebec, Ontario, and the Maritime provinces in the east. We are currently expanding across Canada and into the northern United States. We are on Android platforms with several map and data entry applications.
To ensure the success of our expansion, we aim to become part of the Apple family, which is why we are contacting you today.
We have developed our own GNSS receiver to increase the location accuracy of our users. This device is called GSFGPS. It uses Bluetooth BLE to communicate with mobile devices and a high-precision GPS that transmits its position using the NMEA protocol. We would like this device to be compatible with an iPhone/iPad. We have developed a mock location application in MAUI (multi-platform). Based on our interpretation of your documentation, we understand that the concept of mock location does not exist at Apple. How can we ensure that our Bluetooth GNSS device is compatible with your iPhone/iPad devices and that they can use the position of the Bluetooth device rather than the internal GPS of your devices?
We are a reseller for Juniper Systems, and we know that they have an app on the App Store that has the same features as our product.
https://junipersys.com/index.php/support/article/14709
We look forward to your follow-up and recommendations.
Trying to use new Swift @Observable to monitor GPS position within SwiftUI content view. But how do I tie the latest locations to the SwiftUI Map's mapCameraPosition?
Well ideally the answer could cover:
How to fix this error - So get map tracking along with the User Position, but also
How to include facility to turn on/off the map moving to track the user position (which I'll need to do next). So could be tracking, then disable, move map around and have a look at things, then click button to start syncing the mapcameraposition to the GPS location again
Refer to error I'm embedded in the code below.
import SwiftUI
import MapKit
@Observable
final class NewLocationManager : NSObject, CLLocationManagerDelegate {
var location: CLLocation? = nil
private let locationManager = CLLocationManager()
func startCurrentLocationUpdates() async throws {
if locationManager.authorizationStatus == .notDetermined {
locationManager.requestWhenInUseAuthorization()
}
for try await locationUpdate in CLLocationUpdate.liveUpdates() {
guard let location = locationUpdate.location else { return }
self.location = location
}
}
}
struct ContentView: View {
var newlocationManager = NewLocationManager()
@State private var cameraPosition: MapCameraPosition = .region(MKCoordinateRegion(
center: newlocationManager.location?.coordinate ?? <#default value#>,
span: MKCoordinateSpan(latitudeDelta: 0.25, longitudeDelta: 0.25)
))
// GET ERROR: Cannot use instance member 'newlocationManager' within property initializer; property initializers run before 'self' is available
var body: some View {
ZStack {
Map(position: $cameraPosition)
Text("New location manager: \(newlocationManager.location?.description ?? "NIL" )") // works
}
.task {
try? await newlocationManager.startCurrentLocationUpdates()
}
}
}
#Preview {
ContentView()
}
I am currently developing an application that requires access to GPS coordinates from photos on iOS. However, with the recent update to iOS 18 beta, I have encountered a challenge: I can only view photos within maps, and I am unable to access the GPS coordinates directly.
Could you please provide guidance on how to enable or retrieve GPS coordinates from photos in the current iOS 18 beta version? Any insights or resources you could share would be greatly appreciated.
Thank you for your assistance!
My app has been using MKLocalSearch.Request for keyword-based location searches, and it has worked smoothly for a long time. However, starting last Wednesday, I began receiving an error from MKLocalSearch.start: MKErrorDomain (error code 4).
This issue only occurs when the network environment is based in mainland China (where the API uses the Amap data source). When the network switches to other regions and other Apple Maps data source is used, the error does not occur.
Another complication is that the API doesn't always fail—certain keywords still work (for example, "Huawei").
Already filed a ticket in Feedback Assistant: https://feedbackassistant.apple.com/feedback/15544549
I have an application that uses geolocation to track the user’s location and trigger actions when the app is in either the foreground or background. Currently, it seems that region entry is not triggered unless an app like Maps (which actively uses location services) is opened. The location permissions are correctly set to “Always” with precise location enabled.
We are using geofencing to setup region and trigger actions when entering or leaving.
Is there something I’m missing in the configuration that could be preventing region monitoring from triggering properly when the app is in use or in background?
We create new development maps for builders and developers. Is it possible for us to add the new streets and addresses to Apple Maps so that visitors can find these brand-new streets and addresses?
Hi,
Have been trying to work with MapkitJS for a website, but I'm stumped on once basic capability: I want to be able to click on a point of interest, and perform some actions such as:
Get its coordinates
Attach an annotation to it (e.g. a callout)
In my code, PointOfInterest's are selectable:
map.selectableMapFeatures = [
mapkit.MapFeatureType.PointOfInterest,
];
But when I click on one, I do see the marker pop up but nothing else (which is not much help since there is no additional information in the marker itself). I see no event getting triggered that I can do something with.
I am using an event listener as follows:
map.addEventListener('single-tap', (event) => {
const coordinate = map.convertPointOnPageToCoordinate(event.pointOnPage);
console.log('Map tapped at:', coordinate);
console.log('Map tapped event:', event);
...
I guess I have to grab the Place ID somehow but I don't know how to.
Thanks for any help.
I encountered a crash in iOS 17 related to CLBackgroundActivitySession, which appears to be due to misleading guidance in an Apple’s WWDC video.
Crash sample code: https://github.com/steve-ham/AppleLocationCrash
Simplified Reproduction Steps:
1. Open the GitHub sample app.
2. Archive and export (Distribute App -> Custom -> (Release Testing, Enterprise, or Debugging) -> Export).
3. Open the app.
4. Tap enableBackgroundLocation -> select Allow While Using App on the system popup.
5. Tap disableBackgroundLocation.
6. Go to the iOS home screen.
7. Wait for 10 seconds.
8. Reopen the app -> crash occurs.
The crash happens because setting CLBackgroundActivitySession to nil does not end the session, despite Apple’s guidance suggesting it should. Below is the exact quote from WWDC 2023, which explicitly states that both calling invalidate() or letting the object get destroyed (i.e., setting to nil) would end the session:
WWDC 2023 Discover Streamlined Location Updates (https://developer.apple.com/videos/play/wwdc2023/10180/)
“Before starting the updates, you should instantiate a CLBackgroundActivitySession object to start a new session. Note, we are assigning the session to self.backgroundActivity, which is a property and not to a local variable. And this is important because if we used a local variable, then when it goes out of scope, the object it holds would be deallocated, invalidating the session and potentially ending your app’s access to location. Then when we want to end our session, we can do that by sending the invalidate message or by letting the object be destroyed.”
I’ve submitted this to Apple for resolution but wanted to share this with the community. This misguidance has caused issues in my app’s release. If Apple could reply to confirm or provide clarification, it would be greatly appreciated.
P.S. Even a minimal implementation in viewDidLoad triggers the crash:
let session = CLBackgroundActivitySession()
print("session (session)")
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
Feedback Assistant
Debugging
Core Location
Maps and Location
Can I integrate Timer along with liveUpdates(_:) in order to manipulate the frequency. Let say for example I need the user location ever 1 min. Is it possible to do so?
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
SwiftUI
Core Location
Maps and Location
Background Tasks
Sometimes, I receive old location data from the location manager.
I have noticed a discrepancy between behavior on physical devices and simulators in iOS 18.
I am using the latest MapKit APIs to fetch MKMapItems using the following MKLocalSearch:
private func performLocalSearch(_ query: String) async throws -> [MKMapItem] {
let request = MKLocalSearch.Request()
request.naturalLanguageQuery = query
let search = MKLocalSearch(request: request)
return try await search.start().mapItems
}
This returns an array of MKMapItem on both the simulator and physical device. The key difference is my physical device (iOS 18.1.1) is missing the MKMapItem's identifier value. On the simulator, identifier is always populated in addition to my search. Any ideas on how to resolve this?
The new MapKit API for those curious:
@available(iOS 6.0, *)
open class MKMapItem : NSObject {
@available(iOS 18.0, *)
open var identifier: MKMapItem.Identifier? { get }
Hi all, I have a delivery app that requires the user's location on start up. For example to determine the list of services available to the user. So on start up the app asks for location permission.
While the app does have a concept of creating addresses, we still require location services so that the user can only select an address close to their current GPS.
This is done to prevent fake orders, many apps with similar functionality allow you to pick any location on the map even if you decline location services, which in turn causes a lot of trouble since there are constantly fake orders being created. So to counter that we're asking for the user's location.
Now my question is: will apple force me to absolutely never require location access or will explaining to them the problem of fake orders allow me to pass the review?
Another feature I have is a driving mode, it's a map for drivers to see routes to a specific order. Obviously I need location services for that to function, or will Apple's review team also cling to that and force me to implement some weird way of letting the user choose their current location?
Because there are a lot of trolls that create fake orders, and then have 20 delivery drivers come to a place in a middle of a road. This is a serious issue and will literally kill our business if not countered somehow.
On IOS 18, starting October this year, the location is not syncing in real time.You might drive for several kilometers and the location displayed on Waze will remain on the same position.This might put in position to miss the exit on the highway and have to drive another 40/50 km, lose time and energy, to get back in the original track. Reinstall the application twice is not correcting the behavior, as well as changing the device, the same issue is present on iPhone 16.
Waze support team shared the following:
”Hey there! We'd like to apologize for any hassle that this has caused you. This article: https://tinyurl.com/3fu88jwj might help solve your issue. If you still need help, please open a support ticket by copying and pasting this link: https://tinyurl.com/mrx77ukz in a web browser, and someone from the team will get back to you soon."
Based on the above facts, this is clearly an IOS 18 issue, that needs to be prioritized.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
MapKit JS
Core Location
Maps and Location
When I set the values of notifyOnExit and notifyOnEnter to true when registering CLCircularRegion, I checked that the didExitRegion and didEnterRegion functions are called well. However, there is a problem that they are called twice in a row every time they are called. I was wondering if this is an internal bug in the API.
There is also a stackoverflow report related to the above issue. I would appreciate your confirmation.
stackoverflow - why the didEnterRegion called twice?
Thank you.
Hi,
I have develop the application in the react native. Now this application is related to truck drivers. So we have added load and when they accept the load then we fetch the location to firebase. Now issue is its not working when app close (background) on physical device. We tried on simulator and its working perfectly in the background.
But when i make the build and test on physical device its not working for background task.
We’ve set up an advanced App Clip experience that successfully launches when a user scans our QR code. However, the same App Clip invocation URL does not launch when tapping the associated Action Link on our Apple Place Card in Apple Maps. Instead of opening the App Clip, the link falls back to the website.
What We Have Done So Far:
App Clip Launched in App Store Connect: Our App Clip is approved and live on the App Store. Here is the invocation URL: https://appclip.parkzenapp.com/park?q=oJrbSIgx
Below is the QR code for our Advanced App Clip experience we are attempting to open in our Apple Maps Place card
When scanning the QR code that uses the same App Clip invocation URL, the App Clip reliably launches as expected. Here is our apple-app-site-association file, thats correctly served from the associated domain: https://appclip.parkzenapp.com/.well-known/apple-app-site-association
Add here is a screenshot showing how the appclip.parkzenapp.com domain is correctly validated.
Advanced App Clip Experience: We created and submitted an advanced App Clip Experience specifically tied to our location on Apple Maps. This App Clip Experience is approved and live. Below is an image of our set up of this Advanced App Clip Experience
Business Connect: We've created the Apple Maps Location in business connect and added the advanced App Clip experience invocation URL as an Action Link in the place card. See screenshot below.
Apple Maps Place:
https://maps.apple.com/place?auid=906421750045811407
Despite meeting these conditions, when a user taps the Action Link (the "Reserve" button in the Apple Maps Place Card), the fallback website opens rather than the App Clip.
Question:
What additional step or configuration might we be missing to ensure the Action Link on our Apple Maps place card triggers the App Clip instead of the website?
Thank you