Core Location

RSS for tag

Obtain the geographic location and orientation of a device using Core Location.

Posts under Core Location tag

156 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

About popup asking user if they want to continue allowing the app to use location in the background
Hi everyone,I want to ask and to better understand about the popup that iOS will occasionnally ask the user like :"Weather" has been using your location in the background. Do you want to continue allowing this ?How often dose this occur nad how do they determine when to ask ? And is it possible to prevent this to show to the user ?I can't find any documentation, the only explanation i can find is from the presentation from WWDC 2014 video "What's New in Core Location".Thank,Pat.
10
0
11k
Aug ’23
Using MKTileOverlay and MKPolyLine lose tiles at zoom.
If I have a mapview with a tileoverlay and polyline, the view works until I zoom in close. When zoomed in, the tiles under the polyline don't render, but other tiles not under the polyline do. Xcode 7.3.1 targeting ios 9.3.Below is the minimal test case I have come up with to show this. Any ideas how to debug further? If I remove the polyline overlay, zoom works perfectly fine for all tiles. class MyController: UIViewController, MKMapViewDelegate { @IBOutlet weak var mapView: MKMapView! var overlay:MKTileOverlay = MKTileOverlay(URLTemplate: "https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}.jpg"); override func viewDidLoad() { mapView.delegate = self mapView.showsUserLocation = true; overlay.maximumZ = 15; overlay.minimumZ = 12; overlay.canReplaceMapContent = true mapView.addOverlay(overlay); var points: [CLLocationCoordinate2D] = [CLLocationCoordinate2D]() points.append(CLLocationCoordinate2D(latitude: 40.7608, longitude: -111.8910)); points.append(CLLocationCoordinate2D(latitude: 40.8894, longitude: -111.8808)); var polyline = MKPolyline(coordinates: &points, count: points.count) mapView.addOverlay(polyline) let region = MKCoordinateRegion(center: points[0], span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05)) mapView.setRegion(region, animated: false) } func mapView(mapView: MKMapView!, rendererForOverlay overlay: MKOverlay!) -> MKOverlayRenderer! { if overlay is MKPolyline { var polylineRenderer = MKPolylineRenderer(overlay: overlay) polylineRenderer.strokeColor = UIColor.blueColor() polylineRenderer.lineWidth = 5 return polylineRenderer } else if (overlay is MKTileOverlay) { let renderr = MKTileOverlayRenderer(overlay: overlay) return renderr } return nil } }
1
1
1.1k
Oct ’23
External Bluetooth GPS data source
Hello everyone. I need a clarification with Core Location, please help.How exactly is GPS data passed from external GPS source that is connected via Bluetooth? After some googling I found two separate points:Core Location (CLLocationManager) is responsible only for internal GPS receiver data. For external BT sources I need to use EAAccessory and read NMEA protocol.When I connect an external source, internal GPS is switched off instantly and CLLocationManager starts providing its data. So it must work OK.Thing is, I don't have an external source to test it and I'm not that experienced in BT.I have a report that people cannot use external GPS source with my app (I use Core Location only). Though I also have an info that all navigation apps support external GPS source. So they've already solved this?Or maybe I should check Core Bluetooth out for this?My question is kind of close to this one:https://forums.developer.apple.com/thread/69717?q=gpsMaybe MFi really has a relation to that? And something can depend on GPS device being MFi or being not MFi?Or this one:https://forums.developer.apple.com/message/31679#31679Seems much closer to my topic. So if I got it right, all MFi-supported external GPS data sources should work as is via Core Location?If that's true, is all CLLocation data valid there (when using external source)? Or just altitude and position?
3
2
3.5k
Oct ’23
Clustering stop working after removing all annotations
Hi!I noticed a strange behavior on MapKit when using the iOS 11 clustering feature.If you add some annotations on a map (with same clusteringIdentifier and same displayPriority) MapKit will correctly merge together annotations that are close.The problem is that if you remove all the annotations and then you add them back the map will no more merge the annotation together. It’s like the clustering feature simply stop working.I don’t really know if it is a bug or if I miss something.Someone else have noticed this?Alan
6
0
4.9k
Sep ’23
Dynamically resize Annotation's callout
Hi,I've got annotations on a MKMapView and I added a custom view inside the detailCalloutAccessoryView. This custom view performs a request and should present various amount of data depending on the request's reply. Basically, I can show 1 or 2 rows of data.Sometimes, when I touch an annotation and the result is only one row, the callout is not resized. However, if I dimiss the annotation and select it once again, it is rendered correctly.What is the "right" way to make it work? Using a intrinsicContentSize, or calling layoutIfNeeded (already tried, did not work)Thanks for your help.
1
0
966
Oct ’23
can I get current location in widgetKit
As far as I can tell in my app I am requesting current location in the app and in the widget the same, but I am not ever seeing my widget make the network call the I would expect if current location was successful. I have the same info plist permissions for usage and request for access in both the app and the widget ( runs the same shared code ). My question is does widgetKit work to get core location similar to the the way that today extensions work. or do I need to cache it from the phone app and hope its been updated ?
4
0
2.3k
Oct ’23
App not displayed in Settings App
Whenever I fresh install my app onto my device, it is not showing up in the Settings app. Even after trying to search it, nothing appears. I use location services and local network within my application so I need to be able to change those authorizations as it does not reliably prompt for those authorizations (I need always for location and that was removed, local network never prompts correctly). I have however seen my app appear in the settings app under privacy -> Location Services but not local network. Is this an issue with Apple or with my application? Should also be known that it does appear in settings on some devices.
14
3
20k
Sep ’23
RealityKit : Why ARGeoTrackingConfiguration is not available everywhere ?
Hi, The ARkit is a great tool, I have my small app doing things, and it's fun! but I wanted to try to migrate from ARWorldConfiguration to ARGeoTrackingConfiguration - https://developer.apple.com/documentation/arkit/argeotrackingconfiguration and then we can see that this configuration is limited to a couples of USA only cites. But I can't manage to figure Why and if, in the near future, this will be expanded world wide ?
2
0
1.3k
Jan ’24
NSLocationTemporaryUsageDescriptionDictionary crashes Xcode 13
I just submitted a feedback for this (FB9662125) but in the spirit of “share and enjoy”… The cool new Generate Info.plist File feature in Xcode 13 crashes if you try to put an NSLocationTemporaryUsageDescriptionDictionary in your Info.plist file. Here’s a simple repro scenario: Create a minimal iOS app (no Core Data, no tests) Go to target settings → Info tab → Custom iOS Target Properties Click the (+) button on any row to begin inserting a new row Select Privacy - Location Temporary Usage Description Dictionary Click somewhere else or press Return to commit the selection Xcode crashes immediately More generally, it seems that Xcode crashes any time it tries to regenerate your Info.plist file if it contains an NSLocationTemporaryUsageDescriptionDictionary, even if (for example) you manually pasted that dictionary into the file earlier. In that case, merely tapping the (+) button in step 3 above is enough to crash it.
13
3
3.1k
Oct ’23
Xcode 13.1 iOS 15.0 simulator missing location privacy settings
When I run an app that uses location services on the Xcode 13.1 simulator for iOS 15 the location privacy settings are missing. If you go to the settings on the simulator under privacy the section for location services is missing. The exact same thing on a physical iPhone running iOS 15.0 does show the location settings under privacy in the settings app. Where did the settings for location privacy go? In order to test using the simulator a developer needs to be able to turn those settings on and off, like turning off precise location to see how an app responds.
12
6
15k
Nov ’23
Crash when requesting location authorisation on app startup
I'm trying to diagnose a crash we're seeing in an app that's on TestFlight at the moment. We have the background location permission and are woken by various events, e.g. the significant location change event. I believe the app is being woken in the background and within a few seconds (about 7s in the example below) the app crashes. The crash appears to be when we are confirming what location authorisation the app currently has. As far as we know this is only happening for a single user. Any thoughts on what could be happening? Other forum posts led me to believe it was related to leaking background tasks but I didn't think that was likely after only 7s (and there's no actual mention of background tasks in the crash). Other threads in the crash log have core data relate tasks going on and while we've done a lot of work on our multi-threaded core data I could imagine that being a cause, but surely that would show as a crash on the threads involved rather than thread 0? Any help appreciated, crash log below. John AppVariant: 1:iPhone9,3:15 Beta: YES Code Type: ARM-64 (Native) Role: Non UI Parent Process: launchd [1] Date/Time: 2021-12-13 10:31:18.0065 +0000 Launch Time: 2021-12-13 10:31:11.4169 +0000 OS Version: iPhone OS 15.1 (19B74) Release Type: User Baseband Version: 6.00.00 Report Version: 104 Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Thread 0 name: Thread 0 Crashed: 0 libsystem_kernel.dylib 0x00000001bdd7cb10 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x00000001bdd7d134 mach_msg + 72 (mach_msg.c:119) 2 libdispatch.dylib 0x0000000183f9c734 _dispatch_mach_send_and_wait_for_reply + 504 (mach.c:815) 3 libdispatch.dylib 0x0000000183f9caec dispatch_mach_send_with_result_and_wait_for_reply$VARIANT$mp + 52 (mach.c:2019) 4 libxpc.dylib 0x00000001de30f458 xpc_connection_send_message_with_reply_sync + 236 (connection.c:974) 5 Foundation 0x0000000185a0387c __NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__ + 12 (NSXPCConnection.m:223) 6 Foundation 0x0000000185a09194 -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 2368 (NSXPCConnection.m:1649) 7 Foundation 0x0000000185a49f8c -[NSXPCConnection _sendSelector:withProxy:arg1:arg2:arg3:] + 148 (NSXPCConnection.m:1294) 8 Foundation 0x00000001859ece6c _NSXPCDistantObjectSimpleMessageSend3 + 80 (NSXPCDistantObject.m:282) 9 CoreLocation 0x000000018b0bba0c -[CLLocationInternalClient getAuthorizationStatus:forBundleID:orBundlePath:] + 140 (LocationInternal.m:786) 10 CoreLocation 0x000000018b0ba1fc CLInternalGetAuthorizationStatus + 268 (LocationInternal.m:2063) 11 CoreLocation 0x000000018b0df1c4 +[CLLocationManager _authorizationStatusForBundleIdentifier:bundle:] + 80 (CLClient.mm:1391)
7
4
3.1k
3w
iOS 14+ GPS EXIF data from CAMERA
I am building an iOS app that uses the phone's GPS EXIF data from both camera and image library. My problem is that I while I am able to get GPS data from images in the phone's library, I have not been able to get any GPS data when using the camera within my app. I first built this app about a year ago and at that time I was able to get GPS data from both the library AND the camera from within the app. I believe that at that point I was still building for iOS 12.. I believe that the new security features that came with iOS 13 or 14 now dissalow my app's access to the GPS data when using the camera. This issue is new as of iOS 13 or 14. The code I had was working fine with earlier versions of iOS I am having no issues with getting GPS from the EXIF on the device library images. Images taken with the NATIVE IOS CAMERA APP are saved to the library with full GPS data.  - However I am not able to get GPS data directly from camera image EXIF when using the camera from within my app. When saving an image taking by the camera from within my app the image is saved to the library with NO GPS data. I am able, at any time, to ask the device for current GPS coordinates. As far as I can tell, device settings are all correct. Location services are available at all times.  My feeling is that iOS is stripping the GPS data from the EXIF image before handing the image data to my app. I have searched Apple developer forums, Apple documention, Stack Exchange, on and on for over several weeks now and I seem no closer to knowing if the camera API even returns this data or not and if it will be necessary for me to talk to the location services and add the GPS data myself (which is what I am working on now as I have about given up on getting it from the camera). Info.plist keys I am currently setting:  LSRequiresIPhoneOS  NSCameraUsageDescription  NSLocationAlwaysUsageDescription  NSLocationWhenInUseUsageDescription  NSMicrophoneUsageDescription  NSPhotoLibraryUsageDescription  NSPhotoLibraryAddUsageDescription Am I missing some required plist key? I have been searching and searching for the name of a key that I might be missing but have found absolutely nothing other than people trying to hack some post-camera device location merging. This has been very frustrating.. Any insite is appreciated Is it currently possible to get GPS data directly from the camera's EXIF output any more? Do I need to ask the device for the current GPS values and insert the GPS data into the image EXIF on my own? Is there any example code of getting GPS data from the camera? Is there any example code of inserting GPS data into the Exif before saving the file to the device? Sample swift code which processes the camera image.   func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {     let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage     // let pickedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage     // using editedImage vs originalImage has no effect on the availabilty of the GPS data     userImage.image = pickedImage     picker.dismiss(animated: true, completion: nil)   }
4
2
1.9k
Dec ’23
Electron app crash on open in Test flight
Hello guys, I have an Electron app build with electron forge (v6.0.4). I was able to pass the verification via Transporter and able to install it from TestFilght. but the app was not able to run. I have tried to run the app from Terminal, I got the following error message: FATAL:mach_port_rendezvous.cc(142)] Check failed: kr == KERN_SUCCESS. bootstrap_check_in com.xxxx.yyyyy.MachPortRendezvousServer.39844: Permission denied (1100) Then I looked into the system logs, I found: 2022-12-17 22:03:10.473560 (gui/501 [100006]) : denied lookup: name = com.apple.CoreLocation.agent, flags = 0x1, requestor = AppName[39844], error = 159: Sandbox restriction 2022-12-17 22:03:10.473654 (system) : denied lookup: name = com.apple.locationd.desktop.registration, flags = 0x8, requestor = AppName[39844], error = 159: Sandbox restriction 2022-12-17 22:03:10.482191 (system) : failed lookup: name = com.epsecurity.bdconnectorservice, requestor = BDCoreIssues[162], error = 3: No such process 2022-12-17 22:03:10.537167 (gui/501/com.apple.xpc.launchd.unmanaged.AppName.39844 [39844]) : added unmanaged active 2022-12-17 22:03:10.537647 (gui/501 [100006]) : failed activation: name = com.xxxx.yyyy.MachPortRendezvousServer.39844, flags = 0x1, requestor = AppName[39844], error = 1: Operation not permitted I have tried with/without com.apple.security.personal-information.location in my entitlements file, but looks like no difference. I have spent many days on it, anyone can help?
2
0
1.2k
Aug ’23
Location Push Service Extension. CLLocationPushServiceErrorDomain Code: 1
I'm following Apple guidelines to add the Location Push Service Extension to our app. I followed these steps: I applied and got approved for Location Push Service Extension. My app already asks the user for "Always" permissions for location updates I added the entitlement key com.apple.developer.location.push = TRUE I added to the project a new Target, and selected Location Push Service Extension from the iOS Application Extension group I encouter the following issue. When I run the app and call startMonitoringLocationPushes(completion:) I receive the following error: Error Domain=CLLocationPushServiceErrorDomain Code=1 "(null)" By looking at Apple documentation for CLLocationPushServiceErrorDomain, code 1 stands for: missingPushExtension An error code that indicates the app is missing a Location Push Service Extension. As mentioned beofore I already added the Location Service Extension Target to the project. Any idea of why I receive this error? Thanks
2
0
922
Dec ’23
Is there a way to get satellites count using iOS API?
Below resources says that I cannot. I don't see satellite count related API in Core Location framework document also. 1)This is not possible using any publicly available iOS API. (2012/11/8) https://stackoverflow.com/a/13309242/809671 2)There is no public available API that allows you to get this kind of detailed information about the GPS satellites. (2010/8/24) https://stackoverflow.com/questions/3555732/is-there-a-way-to-get-detailled-gps-satellites-info-on-iphone 3)Confirmed that your app does not have access to the private API used to suss that information. (2017) https://developer.apple.com/forums/thread/73220 4)Since ios does not provide the number of satellites, and since phone gap is designed as a subset of functionality that runs on all phoneplattform, the num satellites is not available. (2015/11/4) https://stackoverflow.com/questions/33516688/phonegap-cordova-get-number-of-gps-satellites 5)The Public SDK doesn't expose that. (2009/12/17) https://stackoverflow.com/questions/1919553/is-it-possible-to-get-gps-satellite-numbers-via-iphone-sdk 6)Can iOS 8 provide info on satellites? No. (2014/8/20) https://forums.macrumors.com/threads/can-ios-8-provide-info-on-satellites.1766861/ Above posts are little old so I want to double confirm. If an Apple developer can reply this then it would be better thanks.
5
0
1.9k
Dec ’23
Granularity/Accuracy of delivered locations with live updates
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
1
0
665
Oct ’23
macos sonoma - unable to change time zone
hi, everyone! i travelled to a different time zone and the time has not updated to my new location. i seem to remember this worked ok before sonoma. system settings - privacy & security - location services - system services - details - setting time zone ON (if this is changed to off it does not stay off, if i leave that window pressing done, when i open that setting again it is still set to on, so changing it has no effect) system settings - general - date & time all set to ON (if Set time zone automatically using your current location is set to off the the Time zone stays greyed out and cannot be changed and only the Closest city can be changed, which is of no use as cities to select from are still not in the time zone i want to change to). this is probably a bug in the new macos sonoma and just wanted to make this known and hopefully have a solution to it. thank you!
10
4
4.7k
Oct ’23