Core Location

RSS for tag

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

Core Location Documentation

Posts under Core Location tag

137 results found
Sort by:
Post not yet marked as solved
1 Views

CoreLocation data across multiple apps

Is it possible to acquire location data in your app when it is triggered by other apps in device? if so, How can I access it?
Asked Last updated
.
Post not yet marked as solved
4.7k Views

Significant-Change Location Service not working properly on iOS 15

We’re expiriencing problems with the location service since the release of iOS 15. We’re mainly using the «Significant-Change Location Service » to get updates if someone moved some distance. For users with iOS 14 or lower, everything seems to work normally. The behavior under iOS 15 is extremely strange. For many users, it seems to work as before and there are regular location updates. For others, there is exactly one location update after the installation. For others, the location updates no longer work after 1-2 days. I have two test devices that no longer receive location updates. If the device is restarted or the location services are turned off and on again, everything works again often again for a few hours or days and stops again. At the moment we are also testing a new release. Where everything works fine in the simulator, but on real devices the location updates do not work either. Does anyone have similar problems with iOS 15 and the Location Services or even a solution for the problem.
Asked
by subster.
Last updated
.
Post not yet marked as solved
1.8k Views

[MapKit JS] Geocoding restriction (follow up)

I really need to have this question answered by Apple Staff if possible, I have asked a similar question before but today I looked at the terms of use for Mapkit JS and got a little bit confused again.Lets say that I have a web application where an user is able to create a shipment request and for others to search and look at. This is partially done by using MapKit JS where user will lookup the pickup/delivery address by the geocoding methods provided by the Mapkit JS library.Is it safe to assume that it is legal to save this response (address, longitude and latitude) to a central database used by the web application for further use? For an example, other users will later on be able to search and display this shipment request in the web application where address, longitude, latitude will be displayed along with other related information and a map will be rendered using the MapKit JS library.
Asked
by sweden78.
Last updated
.
Post not yet marked as solved
89 Views

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)   }
Asked Last updated
.
Post not yet marked as solved
1.9k Views

Background BLE beacon region monitoring not working in iOS 15 which was previously working on iOS 14

My iOS app has BLE beacons detection in it. Which means If user has bluetooth and location on and if user enters the range of a beacon, system automatically awakes the app If it was not running (killed state). This was working fine on iOS 14 and below. Yesterday I updated my device to iOS 15 and app no longer gets awoken while entering a BLE beacon region even If I have enabled "Always" location permission in the settings. Any thoughts ?
Asked Last updated
.
Post not yet marked as solved
313 Views

Must the APNs token for a location-query notification be handled differently than a normal push token?

Hi, I've successfully requested the entitlement for com.apple.developer.location.push with Apple. After creating all relevant provisioning profiles, Push Services Key etc. and verifying that a visible push notification arrives to my physical device I'm stuck when trying to send a location push notification to wake up my Push Location Service extension. I use Firebase FCM to trigger the Push Notification which returns me one of the two things: Success when I try to send a visible notification DeviceTokenNotForTopic (when I try to send a background notification) Invalid Argument - invalid registration token when I try to send a location push notification with the apn headers: apns-push-type --> location apns-topic --> <bundle-id-of-the-main-app>.location-query apns-priority --> 10 (also tried with 5) Is there anything missing to be able to send a location push-type notification? Can I reproduce this without FCM in a easy way via command-line? Thanks!
Asked
by fuzi.
Last updated
.
Post marked as Apple Recommended
1.5k Views

What is a Location Push Service Extension?

There's new API and some header documentation for "Location Push Service Extension"s. I haven't seen any sessions related to Core Location scheduled beyond Meet the Location Button Is there any documentation for this I have missed?
Asked
by slzh.
Last updated
.
Post not yet marked as solved
300 Views

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.
Asked
by Scott J.
Last updated
.
Post not yet marked as solved
252 Views

iOS 15 - Frequently stuck at [CLLocationManager locationServicesEnabled]

After updating to iOS 15, many of our customers are experiencing the hanging issue at [CLLocationManager locationServicesEnabled]. #0 (null) in objc_msgSend () #1 (null) in resolveInstanceMethod(objc_object*, objc_selector*, objc_class*) () #2 (null) in resolveMethod_locked(objc_object*, objc_selector*, objc_class*, int) () #3 (null) in class_getInstanceMethod () #4 (null) in setProtocolMetdataWithMethods () #5 (null) in setProtocolMetadata () #6 (null) in -[NSXPCInterface setProtocol:] () #7 (null) in +[NSXPCInterface interfaceWithProtocol:] () #8 (null) in -[CLLocationInternalClient connection] () #9 (null) in -[CLLocationInternalClient synchronousRemoteObject] () #10 (null) in -[CLLocationInternalClient getLocationServicesEnabled:] () #11 (null) in CLClientIsLocationServicesEnabled () #12 (null) in +[CLLocationManager locationServicesEnabled] () #13 0x0000000100a014cc in -[SWLocationManager startUpdatingLocation:] at /Users/chuh/git/isharing/ios/iSharing/SWLocationManager.m:669 #14 0x0000000100a0140c in -[SWLocationManager startBackgroundLocationManager:] at /Users/chuh/git/isharing/ios/iSharing/SWLocationManager.m:652 #15 0x000000010094bf98 in -[AppDelegate application:didFinishLaunchingWithOptions:] at /Users/chuh/git/isharing/ios/iSharing/AppDelegate.m:224 #16 (null) in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] () #17 (null) in -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] () #18 (null) in -[UIApplication _runWithMainScene:transitionContext:completion:] () #19 (null) in -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] () #20 (null) in _UIScenePerformActionsWithLifecycleActionMask () #21 (null) in __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke () #22 (null) in -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] () #23 (null) in -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] () #24 (null) in -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] () #25 (null) in __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... () #26 (null) in +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] () #27 (null) in _UISceneSettingsDiffActionPerformChangesWithTransitionContext () #28 (null) in -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] () #29 (null) in __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.571 () #30 (null) in -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] () #31 (null) in -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] () #32 (null) in -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] () #33 (null) in -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] () #34 (null) in -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] () #35 (null) in __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 () #36 (null) in -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] () #37 (null) in __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke () #38 (null) in _dispatch_client_callout () #39 (null) in _dispatch_block_invoke_direct$VARIANT$mp () #40 (null) in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ () #41 (null) in -[FBSSerialQueue _targetQueue_performNextIfPossible] () #42 (null) in -[FBSSerialQueue _performNextFromRunLoopSource] () #43 (null) in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ () #44 (null) in __CFRunLoopDoSource0 () #45 (null) in __CFRunLoopDoSources0 () #46 (null) in __CFRunLoopRun () #47 (null) in CFRunLoopRunSpecific () #48 (null) in GSEventRunModal () #49 (null) in -[UIApplication _run] () #50 (null) in UIApplicationMain () #51 0x000000010094b24c in main at /Users/chuh/git/isharing/ios/iSharing/main.m:15 #52 (null) in start ()
Asked
by YongRich.
Last updated
.
Post marked as solved
75 Views

location service IOS 15.0.x and 15.1.x

hi developers my app uses location service, some users are reporting that the app does not appear on their iPhone location services list in the settings. thus they cant give it permission to use the location. they also claim that they did not got the prompt pop up that ask them to turn location on, as I noticed, this happens to users who have updated to 15.0.x and 15.1.x version. before they updated everything worked fine. is anyone have a similar issue? in my info.plist file I have: NSLocationAlwaysAndWhenInUseUsageDescription NSLocationWhenInUseUsageDescription thank you
Asked
by optiSys.
Last updated
.
Post not yet marked as solved
84 Views

Geotracking / ARGeoAnchor available in new geographic areas if an app uses separately collected point cloud data?

Geotracking (And therefore ARGeoAnchor) is only available in specific geographic locations, however can an app use separately collected geographic point cloud data to localize against thereby allowing one to use this feature at new geographic areas?
Asked Last updated
.
Post not yet marked as solved
101 Views

watchOS - map shows for an instant, then replaced with blue screen

I have a watchOS app that shows a map with the device's current location. This works as expected on a simulator. On a device in TestFlight, the map shows for an instant, but then the map area turns blue. When I zoom in and out, again, the correct map shows for an instant, but then the screen turns blue. I have a couple of images to illustrate the issue: I'm attaching the mapping code below: super.awake(withContext: context) if CLLocationManager.locationServicesEnabled() { locationManager.requestAlwaysAuthorization() locationManager.requestWhenInUseAuthorization() locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.distanceFilter = kCLDistanceFilterNone locationManager.startUpdatingLocation() } else { print("Problem with permissions") return } let span = MKCoordinateSpan( latitudeDelta: 0.005, longitudeDelta: 0.005 ) #if targetEnvironment(simulator) let location = CLLocationCoordinate2D( latitude: simulatorLatitude, longitude: simulatorLongitude ) let region = MKCoordinateRegion(center: location, span: span) mapView.setRegion(region) mapView.addAnnotation(location, withImageNamed: "mapPinRed", centerOffset: CGPoint(x: 0, y: 0)) #else locationManager.requestLocation() #endif } override func willActivate() { // This method is called when watch view controller is about to be visible to user } override func didDeactivate() { // This method is called when watch view controller is no longer visible } func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { print(#function, "Status: ", status.rawValue) if status.rawValue == 0 { locationManager.requestAlwaysAuthorization() locationManager.requestWhenInUseAuthorization() locationManager.requestLocation() } } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let currentLocation = locations[0] let lat = currentLocation.coordinate.latitude let long = currentLocation.coordinate.longitude self.mapLocation = CLLocationCoordinate2DMake(lat, long) //let span = MKCoordinateSpan.init(latitudeDelta: 0.1, longitudeDelta: 0.1) let region = MKCoordinateRegion.init() self.mapView.setRegion(region) self.mapView.addAnnotation(self.mapLocation!, with: .red) } func centerMapOnLocation(location: CLLocation) { #if targetEnvironment(simulator) let region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: simulatorLatitude, longitude: simulatorLongitude), span: MKCoordinateSpan(latitudeDelta: CLLocationDegrees(zoomValue), longitudeDelta: CLLocationDegrees(zoomValue))) DispatchQueue.main.async { self.mapView.setRegion(region) } #else let region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude), span: MKCoordinateSpan(latitudeDelta: CLLocationDegrees(zoomValue), longitudeDelta: CLLocationDegrees(zoomValue))) DispatchQueue.main.async { [self] in self.mapView.setRegion(region) self.mapView.addAnnotation(location.coordinate, withImageNamed: "mapPinRed", centerOffset: CGPoint(x: 0, y: 0)) } #endif } My permissions are set in Watch.extension info.plist as follows: Privacy - Location Always Usage Description Privacy - Location Always and When In Use Usage Description Privacy - Location Usage Description I  would appreciate any help.
Asked
by davidd.
Last updated
.
Post not yet marked as solved
833 Views

ios 12 location bug?

Good day!On iOS 12 devices, I have strange situation, sometimes CLLocationManager returns location with bad latitude (usually zero) and proper longitude. And (as from user request to our API) it is very often situation.I can't reproduce it in debug to submit a demo project or something like that.We noticed such situation after public release of iOS 12, and have reports mostly from iOS 12 users.
Asked
by mrdekk2.
Last updated
.
Post not yet marked as solved
1.4k Views

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.
Asked
by Bussa.
Last updated
.
Post not yet marked as solved
141 Views

CLLocation Manager returning wrong speed when tested in moving real device

Greetings, I am implementing an app and it has a label that shows user current speed when driving in a car. I did everything to setup location manager and I have made it sure user has provided all the necessary permissions. Apart from that I have set desiredAccuracy as kCLLocationAccuracyBestForNavigation. Now the problem is when am travelling in a car with a much higher speed for example 50 km/hr it shows me the speed is 14 km/hr I have used below code in didUpdateLocations Multiline         var speed: CLLocationSpeed = CLLocationSpeed()         speed = locationManager.location?.speed ?? 0 * 3.6                   if speed > 0{             let speedTxt = String(format: "%.0f km/h", speed)             print(speedTxt)             kmBtn.setTitle("(speedTxt)", for: .normal)         }else{             kmBtn.setTitle("0 Km/h", for: .normal)         } BlockQuote NOTE : Here I have multiplied the speed with 3.6 to convert the value from meterPerSecond to KilometerPerHour Why its not returning the accurate speed and how to get that ?
Asked
by GulamAli.
Last updated
.