I am working with the CLBackgroundActivitySession and CLServiceSession to figure out why our app is sometimes terminated in the background.
I am unable to understand what "insufficientlyInUse" corresponds to, it could be understood as
The location data is not being used enough
the "While in use" permission is not enough
It will be very helpful if the entire enum can be explained, I am attaching the one for CLServiceSession since it is a superset of CLBackgroundActivitySession from CoreLocation
extension CLServiceSession {
public struct Diagnostic {
public var authorizationDenied: Bool { get }
public var authorizationDeniedGlobally: Bool { get }
public var authorizationRestricted: Bool { get }
public var insufficientlyInUse: Bool { get }
public var fullAccuracyDenied: Bool { get }
public var alwaysAuthorizationDenied: Bool { get }
public var serviceSessionRequired: Bool { get }
public var authorizationRequestInProgress: Bool { get }
}
...
}
Looking forward to hearing from you
Maps & Location
RSS for tagLearn how to integrate MapKit and Core Location to unlock the power of location-based features in your app.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm building a weather map that shows the rain on the map. I'm able to retrieve PNG images that are used as tiles to put onto the map. I then reload all the tiles on the map with each timeframe (tile set for every 10 minutes).
I'm able to get the map loaded up and I'm able to place the tiles and reload the data for each time slot. But I'm getting a ton of spam on the console every time the tiles are reloaded.
Failed to locate resource named "sky20Grey0@2x.png"
Failed to locate resource named "sky20Grey0@2x.png"
Compiler failed to build request
Compiler failed to build request
Compiler failed to build request
Compiler failed to build request
Compiler failed to build request
Compiler failed to build request
Compiler failed to build request
Compiler failed to build request
Compiler failed to build request
Yet the images are showing on the map just fine. But I feel like it's a bit sluggish due to all the spam coming out as I'm reloading this every 0.5 seconds with a timer.
I've tried to load the data from a remote server on demand by overriding the - (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result function. But due to the timer this can lead to the data not getting loaded fully before it switches to the next time slot of data. I therefore pre-load everything. I can then store the NSData in memory and use loadTileAtPath or the NSURL to a stored file and use - (NSURL *)URLForTilePath:(MKTileOverlayPath)path. Both cases work. But both cases have this spam.
I've further refined things such that the MKTileOverlayRenderer is reused but that didn't help. Here's the function for that..
- (MKOverlayRenderer*)mapView:(MKMapView*)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
if ([overlay isKindOfClass:[MKTileOverlay class]]) {
if (!self.rainRenderer) {
self.rainRenderer = [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay];
self.rainRenderer.alpha = 0.5;
}
return self.rainRenderer;
}
return nil;
}
I'm using one MKOverlay and then just reloading the tiles as needed. Otherwise there is quite a pronounced flicker. Here's that function which is triggered by the NSTimer to happen every 0.5 seconds.
- (void) updateRainFrame {
self.currentFrameIndex = (self.currentFrameIndex + 1) % self.timestamps.count;
if ((self.currentFrameIndex >= 0) && (self.timestamps.count > self.currentFrameIndex)) {
NSLog (@"self.currentFrameIndex = %lu", self.currentFrameIndex);
NSString *timestamp = self.timestamps[self.currentFrameIndex];
[self.overlay setTimestamp:timestamp];
[self.rainRenderer reloadData];
}
}
In that function I'm updating the "timestamp" in the overlay which is the time slot that contains all the tiles for that time. This way my overridden MKTileOverlay can then pass the correct path for the tiles. For example for loading from a file:
- (NSURL *)URLForTilePath:(MKTileOverlayPath)path {
return [self getWeatherTileFileURLForPath:path];
}
Or NSData stored in memory
- (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result
{
return [self getWeatherTileDataForPath:path];
}
But no matter which way I use I keep getting this spam and unfortunately there is no error or anything to point to why it is spamming out.
Also the tiles themselves are PNG files either 256x256 or 512x512 in pixel size.
I saw that this could be something to do with Metal but I'm assuming that's something that MapKit uses.
Very much welcome any thoughts to what could be causing this?
First of all :
Thanks for the great presentation (wwdc2023-10180), Siraj !
This new, simple API looks like what we've been looking for for easy manageable background location updates with 'automatic battery drain minimization' :-)
There were two questions that came to my mind. As far as I understood, the CLLocationUpdate.LiveConfiguration is used to help the location services to improve the location fixes.
Are there other options planned to specify the granularity of delivered locations e.g., how accurate the locations need to be (as the desiredAccuracy and distanceFilter settings for the olden CLLocationManager)?
Does the Implementation switch between significant location changes and regular, more expensive ways (like GPS hardware) or just deliver the most feasible accuracy available at the time of notification?
I'm just curious - if I get the most feasible granularity, everything is fine for me anyway :-)
Thanks again,
Michael
Hello within these last two updates find my location has been turned off for my other phone number, only a specific number can’t see my location, but everyone else can see my location, I am puzzled as to what is going on
I am working on a duress app and would like to improve location accuracy by encouraging users to enable Wi-Fi. In Apple Maps, I noticed that when Wi-Fi is off, a dialog prompts users to turn on Wi-Fi to enhance location accuracy. I am looking to implement similar functionality in my app.
Specifically, I would like to check whether Wi-Fi is enabled on the user's device (even if it is not connected to a network). Despite exploring several methods, I have been unable to determine a reliable way to check the Wi-Fi status.
Can you guide me on whether it is possible to access this functionality in iOS, and if so, how I can implement it within my app?
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.
Hi Team,
when our customers turn on bluetooth connectivity whether Apple creates a profile of the user or their locations and if it is used for any other purpose.
Could you please clarify this?
we are getting the below message in the Bluetooth permissions popup below the map "Information from Bluetooth devices can be used to determine your location and create a profile of you."
What is this profile? and what is the purpose of creating it while the user uses Bluetooth in ios app.
Topic:
App & System Services
SubTopic:
Maps & Location
Hello (:
I have a question regarding the current pricing model for Apple Maps APIs, specifically MapKitJS, the Maps Snapshot API, and the Maps Server API. Previously, the documentation and my understanding indicated that the usage limits were defined per day — for example, 250,000 map loads per day for MapKitJS and 25,000 snapshots per day. However, in the Apple Developer Dashboard, I’m now seeing these limits shown on a per-month basis, such as only 25,000 snapshots per-month. This appears to contradict the publicly available information on the official website, which still states daily limits. Has the pricing model officially changed, or is this just a display issue in the dashboard?
I need to know this because we're going into release soon, and then we might have thousands of users.
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
Maps Web Snapshots
MapKit JS
Apple Maps Server API
Hello (:
I’m working with MapKitJS and would like to render polylines that follow roads — similar to the behavior seen on maps.apple.com. While I can align polylines to roads manually, I haven’t found a way to render them below street names and road shields. Currently, all polylines appear above labels, which reduces readability when displaying routes in urban areas.
On maps.apple.com, polylines are rendered under street labels, which provides a much cleaner appearance. Is there a way to achieve this layering behavior in MapKitJS? If not, are there plans to support this kind of layer control in the future?
Thanks in advance!
MapKitJS (5.45.0):
maps.apple.com:
Hello,
I'm encountering a runtime crash when building my visionOS app with Xcode 16.3 for visionOS 2.5. Our existing AppStore/Testflight app is also instantly crashing on visionOS 2.5 when opened but works fine on e.g visionOS 2.4.
The app builds successfully but crashes on launch with this symbol lookup error (slightly adjusted because the forum complained regarding sensitive data):
Symbol not found: _$sSo22CLLocationCoordinate2DVSE12CoreLocationMc
Referenced from: <XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX> /private/var/containers/Bundle/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/MyApp.app/MyApp.debug.dylib
Expected in: <XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX> /usr/lib/swift/libswiftCoreLocation.dylib
dyld config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/usr/lib/libLogRedirect.dylib:/usr/lib/libBacktraceRecording.dylib:/usr/lib/libMainThreadChecker.dylib:/System/Library/PrivateFrameworks/GPUToolsCapture.framework/GPUToolsCapture:/usr/lib/libViewDebuggerSupport.dylib
I've already implemented my own Codable conformance for CLLocationCoordinate2D:
extension CLLocationCoordinate2D: Codable {
// implementation details...
}
This worked fine on previous visionOS/Xcode versions. Has anyone encountered this issue or found a solution?
System details:
macOS version: 15.3.2
Xcode version: 16.3
visionOS target: 2.5
Thank you!
Hello,
I’m experiencing an issue with my iOS app that uses CoreBluetooth in combination with beacon monitoring. My app is designed to wake via beacon region monitoring and then start scanning for a specific BLE peripheral (with specific service UUIDs). When the device screen is bright (i.e., the device is unlocked, or locked but the screen is active/bright), everything works perfectly—the connection is established and maintained without any issues in both: foreground and background.
However, when the device is left alone for a while and the lock-screen dims (sleeps), the app continues to run in the background and range the beacon (I can confirm this via realtime console logs), but the connection attempt fails. Here’s what I observe:
The central manager’s delegate method didConnect is called, indicating that the peripheral was connected.
Almost immediately afterward, didDisconnect is triggered with the error message:
"The specified device has disconnected from us.".
The interesting part is (I repeatedly see this error in the console, because the app repeatedly tries to connect to peripheral until a success), when I touch the lockscreen (not unlock, but just touch, which makes the screen to light up brighter), the connection is being established without any further issues!
I have the necessary background modes enabled in the app’s capabilities (e.g., bluetooth-central, location-always-mode, etc..). My expectation was that, thanks to beacon monitoring, the app would be awakened when needed, and scanning/connection would work reliably in the background regardless of whether the device is active or dimmed.
My questions are:
Why might the connection fail with this error when the device is locked/dimmed?
Is this behavior expected due to iOS power management policies even if the app remains active in the background?
Is there a way to ensure a reliable connection in such cases?
Any insights, workarounds, or suggestions would be greatly appreciated. Thank you in advance!
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
Core Location
Background Tasks
Core Bluetooth
We are using MapKit JS Look Around and initializing it like this:
window.lookAround = new mapkit.LookAround(
document.getElementById('container'),
new mapkit.Coordinate(listingLocation[1], listingLocation[0]),
{openDialog: false})
;
This results in a Look Around scene being displayed correctly but the camera heading is not pointing towards the lat/lng that is passed to initialization. The example lat/lng that we're using is: lat=30.004195, lng=-95.59973
This lat/lng corresponds to the address: 11943 Laurel Meadow Dr, Tomball, TX 77377. The camera is pointing to the other side of the street to house number 11946. If you look for that address in Apple Maps the Look Around points to the correct house.
Is there a way to either specify the heading so that Look Around points in the correct heading?
Sample link: https://s.hartech.io/zFP2KnsCbsP
I have the CarPlay Entitlement "Driving Task" and two of my apps use it.
Now, in both apps, I have implemented Navigation. I requested the Navigation CarPlay Entitlement when the feature was mature and builds were available in Test Flight, since I wanted to release the new versions of the apps with navigation available both on the iPhone and in CarPlay.
I got no answer to my request, so I decided to release the apps with only navigation in the iPhone and the Driving Task functionality in CarPlay, thinking that maybe being live with navigation in the App Store was a requirement. I have asked permission again, and so far, the request is being ignored again.
What are the requirements to get the Navigation CarPlay Entitlement?
If the app is approved for navigation, is there something else the app must do to get the entitlement?
Requirements for CarPlay Entitlements seem quite obscure, are they listed anywhere?
Is there a technical problem to move from an existing CarPlay Entitlement to another? Can that be the reason the entitlement has not been granted?
Some of my competitors have the CarPlay Navigation entitlement. My use case is the same (in a better app in my opinion, of course). But I am only getting bad reviews because "the app does not include the map in CarPlay" after the big investment in implementing navigation in the apps.
Any help or insight would be appreciated.
According to the following article, the CLCircularGeographicCondition has a limit whereby only 20 conditions can be monitored by any single app.
Monitoring the user’s proximity to geographic regions
While I understand the rationale behind this limit, 20 conditions seems quite low for some apps. It would be good if an app could request that the user opt-in to allowing more conditions if they understand the impact this might have on the battery etc.
I'm migrating an app presently to use CLCircularGeographicCondition instead of the now deprecated CLCircularRegion. It would be good if there were more guidance on how to use the new Core Location API's to monitor how many conditions are in use within an app and how they can be deactivated when no longer required, allowing the app to free up more of the 20 conditions available.
Hi,
Does anyone know how can a company sign up to be a publisher for guides on apple maps? Example - https://maps.apple.com/guides?publisher=17882075820533551969&_provider=9902
I'm having hard time figuring out the process.
Hi,
I'm building an aftermarket solution to enable Apple Maps to support EV routing for any EV.
I am going through the documentation and found some gaps - does anyone know how the following properties work?
INGetCarPowerLevelStatusIntentResponse - consumptionFormulaArguments
INGetCarPowerLevelStatusIntentResponse - chargingFormulaArguments
Is there a working example that anyone has seen?
Many thanks
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
CarPlay
SiriKit
Maps and Location
App Intents
I have implemented geofencing using CLMonitor.
The implementation follows this general structure:
private var monitorTask: Task<Void, Never>?
private var backgroundSession: CLBackgroundActivitySession?
func start() async {
backgroundSession = CLBackgroundActivitySession()
monitorTask = Task {
do {
let monitor = await CLMonitor("monitor")
for try await event in await monitor.events {
handleEvent(event: event)
}
} catch {}
}
}
func addSpot() async {
let monitor = await CLMonitor("monitor")
let center = CLLocationCoordinate2D(latitude: 0, longitude: 0)
let condition = CLMonitor.CircularGeographicCondition(center: center, radius: 100)
await monitor.add(condition, identifier: "sample-1")
}
When the app is not task-killed, the code inside handleEvent executes as expected.
However, after a user-initiated task kill, the functionality does not work properly.
I want to use MapKit with App Intents, but the map does not show up.(See attached image)
Can anyone help me solve this?
import SwiftUI
import MapKit
struct ContentView: View {
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 37.334_900,
longitude: -122.009_020),
latitudinalMeters: 750,
longitudinalMeters: 750
)
var body: some View {
VStack {
Map(coordinateRegion: $region).frame(width:300, height:300)
.disabled(true)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
import AppIntents
import SwiftUI
import MapKit
struct test20220727bAppIntentsExtension: AppIntent {
static var title: LocalizedStringResource = "test20220727bAppIntentsExtension"
func perform() async throws -> some IntentResult {
return .result(value: "aaa", view: ContentView())
}
}
struct testShortcuts:AppShortcutsProvider{
@available(iOS 16.0, *)
static var appShortcuts: [AppShortcut]{
AppShortcut(
intent: test20220727bAppIntentsExtension(),
phrases: ["test20220727bAppIntentsExtension" ]
)
}
}
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
App Intents
wwdc2022-10032
wwdc2022-10170
Does visionOS support mapkit?
I have App uploaded to app store but it was rejected 5 times because of the location and photo permission purpose string the idea of the app is to add compliment , choose the location on the map and some info and the location is not associated to user identity it just to show his place on the map if the place he want to pick is near him he can refuse location permission the map can open and pick the point he want and need permission for images to add images with compliment , I need help for location and images permission purpose string.
Topic:
App & System Services
SubTopic:
Maps & Location