Post not yet marked as solved
Hello Team,
We have an app that we use to track our drivers for delivery, if a driver reaches a geofence it triggers an alert back to the dispatcher that the driver has completed his drop and is ready to take the next one. The app connects to the backend once every few minutes to retrieve available orders. We are using significant location changes and run most of the calculations on the device.
Issue is when the device reboots the app goes cold and we do not have any pings back to the server neither get any geofence breach notifications.
Is there a way to do this?
We anticipate this app to be on all of our employee devices(which we own).
Thanks!
Post not yet marked as solved
Hello All,
Does anyone face issues getting trigger Geofence event or Significant Location update event is suspended and background state,
I am facing an issue where the feature works most of the time and some time geofence and location updates do not trigger any callbacks, Sometimes I am getting triggered after 11 or 12 minutes later, most of the time, I get location updates in 2 or 3 minutes, for making it work again I need to start the application and put it back to a background/suspended state
And the permission for access in the background is also "Always"
Thanks
Post not yet marked as solved
Since updating to Xcode 13.2 (13C90) my App crashes instantly when instantiating a CLLocationButton, but this only happens when running the App in the Simulator.
My setup code looks as follows:
let button = CLLocationButton()
button.icon = .arrowOutline
button.label = .none
button.cornerRadius = Style.CornerRadius.double
button.backgroundColor = .white
button.tintColor = ColorCatalog.Colors.themeColor.color
button.addTarget(self, action: #selector(userLocationButtonTapped), for: .touchUpInside)
userLocationButton = button
view.addSubview(userLocationButton)
// setting up constraints for CLLocationButton to be on the top right corner
button.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
button.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16.0),
button.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16.0)
])
}
On Xcode 13.1, this works just fine.
On Xcode 13.2 I get this exception when run in the Simulator:
In the console it prints:
2021-12-14 13:02:13.003747+0100 appname[9412:217536] *** Assertion failure in CGImageRef _Nonnull UISCreateImageFromDrawing(__strong id _Nonnull, CGFloat, UISDisplayRange)(), UISDrawing.m:19
Post not yet marked as solved
Is there a case where the speed received by CoreLocation can be equal to 0 even though the device is moving ?
In my current project we have encountered this case several times on a iPhone 12. Is it a known issue ?
Post not yet marked as solved
Hi guys,
I have built a PWA that calls the javascript API navigator.geolocation.getCurrentPosition which prompts the user for location access when the Safari permission is set to Ask. This is the correct behavior and works as expected when open in Safari.
However when added to the Home Screen and running with a display mode of "standalone", the location alert does not open on my phone (iPhone 13 mini / iOS 15.1.1). And the call never times out. Then if I switch from the PWA to Safari the location alert / prompt is suddenly showing in Safari. So it seems that the alert is targeting the wrong "tab". This does not happen if the PWA display mode is "browser" or "mimimal-ui" with either of those it behaves normally.
I can only replicate this on my phone (iPhone 13 mini / iOS 15.1.1). I have also tested on various older phones (15.1.1 and 14.7) as well as several emulators and they all behave as expected.
It is possible this is a obscure setting on my phone but it does feel a lot like an iOS Safari bug.
Post not yet marked as solved
My question is how do you get ahold of the current user location title when clicking a button so that it can display the title inside the search bar. I know that by calling locationManager.requestLocation() inside my button it will redirect the user to current location but that is all know how to do. I've tried calling locationManager.location?.description but i had no luck.
Post not yet marked as solved
I'm developing an app that needs to monitor user location and, due to some feature, I need to send a Location Push Notification to send the device location to the server.
This is everything I did, following the apple doccumentation:
I requested (and obtained) the com.apple.developer.location.push entitlement to Apple and I included it in the app.
I created the proper certificates and added the proper signing capabilities to the app.
I created a Location Push Service Extension in my app.
I asked the user a token with startMonitoringLocationPushes and I sent it to the server.
I established a Token-Based Connection to APNs and I sent the notification request.
After several attempts, everything now seems to work fine, as I receive a status 200 from APNS and no error messages, but the app doesn't receive the notification, or the extensions doesn't get "awakened/fired".
How can I understand what's wrong?
I'm pretty sure that all the procedure is correct because I don't receive any errors like TokenNotForPurpose, BadToken, or else... I had these errors at first attempts but now I get status 200...
I hope someone coulp help me, I'm going crazy trying to solve this and my customer waiting is going nervous waiting for the app to be released
Post not yet marked as solved
I am writing an iOS app that requires continuous location updates while being in the background. I am using CLLocationManager and here is what I am doing:1) Requesting always authorization2) Enabling background location in info.plist3) Setting allowsBackgroundLocationUpdates to true4) Starting location updates while in the foregroundThe app gets location updates when in foreground. App also continues to get location updates in background every 1 second, until some time when the app gets suspended and does not get any further location updates. When the app gets suspended varies from anywhere between few 10s of minutes to hours. I have even noticed that the app sometimes does not get suspended but stops getting location updates.My question is: is there a way to continuously get location updates indefinitely (or say for 24 hours) with the app in the background and not getting suspended. And if the app gets suspended, is there a way to wake up the app and resume getting continuous location updates without the user bringing the app to the foreground?I have tried significantLocationUpdate to wake up the app and restart my location manager. With this I am able to get significantLocationUpdates for days but I get location updates about once every 5 minutes (while driving) but the location manager that I create and start to get continous frequent locations does not return any locations. I would like to get it more frequently, like once every few seconds.Any help would be much appreciated.Thanks.
Post not yet marked as solved
I am trying to work out how to start updating locations when triggered by a CLRegion in iOS 15. The use case is that a user gets to a certain predefined starting point (determined by region monitoring) for a regular journey and then the app startUpdatingLocation, without need for user interaction. In my testing so far, if I call startUpdatingLocation from within didEnterRegion the updates stop within 10.
Post not yet marked as solved
Hi,In my app, If app is running in foreground, I need user's current location.But I have doubt regarding messages for privacy authorization which would be shown in prompt and setting screen of APP-In Current implementation We are showing below messages -:NSLocationAlwaysAndWhenInUseUsageDescriptionEnable location services “Only While Using the App” to choose your car upon arrival and return your car via the app at most locations. You can also find nearby locations, gas stations, and places to park. Choose “Always Allow” to further personalize your experience.NSLocationAlwaysUsageDescriptionEnable location services to choose your car upon arrival and return your car via the app at most locations. You can also find nearby Avis locations, gas stations, and places to park.NSLocationWhenInUseUsageDescriptionEnable location services to choose your car upon arrival and return your car via the app at most locations. You can also find nearby Avis locations, gas stations, and places to park.Here the discription for whenInUse and AlwaysAllow is same because in iOS10, prompt will be shown with two buttons allow and don't allow instead of "always allow" and "while in use" button titles and the description of NSLocationAlwaysUsageDescription will be shown in prompt and setting screen.And for iOS11 NSLocationAlwaysAndWhenInUseUsageDescription this message would be shown which is correct because in iOS11 there will be three button "always allow", "while in use" and "never".Is that description is suitable for NSLocationAlwaysUsageDescription for iOS 10or do we need to change the message to specify the description of always allow?Your help would be appreciated.ThanksAmit Gupta
Post not yet marked as solved
Hello,
I was uploading new builds for 2 Apps (they have the Location Entitlements on info.plist)
I've installed them on 3 different iPhones and they don't have the Location Permissions on Settings anymore:
It stopped working last week, for newer builds, as well as with older builds which were proven to work
When installing the same builds on TestFlight for Silicon MacBook, the laptop has setting to enable Location for this App .. so it shouldn't be a 'signing' or 'setup' conflict
When I run a release build with xCode via USB to my phone, works correctly
I had the TestFlight version installed long ago (i only clicked update to the last build). The location settings were on my Phone. The problem arose for the testers that installed any of our builds this last week
When I uninstalled and installed it again, the location settings were gone for me too
It's like that when our Apps go through TestFlight Servers, a failed build is provided to us.
I'm happy to help solve this,
thanks.
Eze
Post not yet marked as solved
Hi all,Currently building an app for an organisation and as part of their requirements is that they want to always be tracking locations for their employees and is agreed to legally as part of their contracts.Has anyone ever come across always allowing location permissions or have any suggestions to how this could be done please?
Post not yet marked as solved
Unexpected operation found. Details are below:
Conditions and configurations used in the testing:
"Background Modes" Capability with "Location updates" checked on
Added the info.plist keys: NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription with description
Monitoring for several beacon regions and invoking startMonitoringSignificantLocationChanges using core location API
My app's location authorization status set 'Always'
Added UserNotification in func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool , so that a notification could be triggered in AppDelegate method when an application is launched.
How I tested
Given the condition above applied,
I have closed my application by force using "swiping up in the app-switcher screen"
What I expected
I have been convinced that "close-by-force" triggers the removal process of the target application(my app) from the memory. And it stays so until it is relaunched by the system given the specific location-related events - such as entering into registered beacon region or moving over 500-meter(significant locations changes).
What I actually found
I have discovered that in some versions of iOS, specifically iOS 15.3 and iOS 15.3.1, my application was relaunched immediately and automatically as soon as the app was closed(close-by-force). No beacon enter or moving over 500-meter events are involved.
This unexpected relaunching issue was not found in the other version of iOS. I have tested eleven devices that are using iOS 10.3.3 ~ 15.1.
What I want to know
I am wondering if this relaunching case in iOS 15.3 and 15.3.1 is an unexpected bug or not.
In addition, I also want to know why it is working differently between iOS versions.
Thanks for your help in advance.
Post not yet marked as solved
Hello All,
Does anyone face issue getting trigger Geofence event or Significant Location update event is suspended and background state in IOS 15,
I am facing an issue where the feature works most of the time and some time geofence and location updates do not trigger any callbacks, for making it work again I need to start the application and put it back to a background/suspended state
And the permission for access in the background is also "Always"
Thanks
Post not yet marked as solved
Why locationManager did disconnect in this circumstance?
Always after START -> STOP -> START service.
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = 5; // meters
locationManager.allowsBackgroundLocationUpdates = YES;
locationManager.pausesLocationUpdatesAutomatically = NO;
if (@available(iOS 14.0, *)) {
if (locationManager.authorizationStatus == kCLAuthorizationStatusAuthorizedWhenInUse){
[locationManager startUpdatingLocation];
} else {
shouldStart = false;
[locationManager requestWhenInUseAuthorization];
}
} else {
// Fallback on earlier versions
}
--- resume log ---
{"msg":"#sbim client arrow state changed", "clientKey":"it.trainingcamp.app", "entityClass":"Application", "oldArrowState":"ReceivingLocationInformation", "newArrowState":"RequestingLocationInformation", "dueToDeauthorization":0}
client 'it.trainingcamp.app' authorized for location; starting shortly
client 'it.trainingcamp.app' authorized for location; starting now, desiredAccuracy, -1.0, distanceFilter, 5.0, operatingMode 0, dynamicAccuracyReductionEnabled 0, allowsAlteredAccessoryLocations 0, activityType 0
[application<it.trainingcamp.app>:9023] Suspending task.
Calculated state for application<it.trainingcamp.app>: running-suspended (role: None)
Process runningboardd.34 Released SystemIsActive "application<it.trainingcamp.app>34-77-203313:Location subscription" age:00:00:31 id:51539648441 [System: SysAct]
-CMSessionMgr- CMSessionMgrHandleApplicationStateChange: Client it.trainingcamp.app with pid '9023' is now Background Suspended. Background entitlement: YES ActiveLongFormVideoSession: NO WhitelistedLongFormVideoApp NO
-CMSessionMgr- CMSessionMgrHandleApplicationStateChange: Sending stop command to it.trainingcamp.app with pid '9023' because client is background suspended and there is no AirPlay video session for it
[application<it.trainingcamp.app>:9023] Setting process task state to: Suspended
Post not yet marked as solved
My understanding is that when an app enters the background, the app will run for a period of time and eventually will be suspended, and while in the background can continue to run tasks. Then with no activity an app in the background will be suspended but remain in memory subject to the system purging it on low memory events.
When the app is suspended it stops executing code. The user can terminate an app by swiping up from the Home Screen. When an app is suspended and purged or terminated by the user all objects including view controllers are removed from memory and cannot receive updates from the UIApplication object. An exception is region updates, which will be picked up by the appDelegate when the app is in the background, suspended or terminated, and will "activate" the app for processing the event.
I also understand region objects are retained in memory regardless of the app's state. Thus on entering a region, the appDelegate can deal with the region entered in whatever state the app might be in.
I'm working on an app that uses region monitoring. I have put the didEnterRegion and didExitRegion CLLocationManagerDelegate functions in the appDelegate, where I also set up and start location services. I have one MasterViewContoller for UI reporting enter/exit region activity and one NSObject class Comm that handles enter/exit events by sending off an http post. This Comm object is instantiated in the MasterviewController like this:
let comm = Comm()
and the MasterViewController is reference in appDelegate like this:
var vc = MasterViewController()
In appDelegate I have the didEnterRegion and didExitRegion functions:
func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion)
{
if region is CLCircularRegion {
let identifier = region.identifier
[NOTE: code here to issue a local notification for testing - this functions regardless of the app's state]
vc.processRegionEvent(regionid: identifier)
comm.sendHttp(theid: identifier)
}
}
This works as expected so long as the app is not in the background or has been terminated - e.g. manually by the user or by the system for being in the background for a while. But once the app is terminated or goes to the background, neither the viewController or the Comm class consistently respond. Sometimes they respond and sometimes not - this is what I am trying to isolate and fix.
It appears that even though the appDelegate "activates" and responds to region events, that doesn't mean the app and its objects are fully loaded and ready to respond to events and function calls.
When using region monitoring, what is the preferred method to insure the relevant objects such as a viewController and other classes are instantiated and able to respond to region changes picked up by the appDelegate when the app is in the background or terminated? Is is necessary to put the entire code in appDelegate?
Post not yet marked as solved
Hi,
Our application needs to receive and process positions, even in background. The associated UIBackgroundMode is activated, and everything was working well until I updated a test tablet to 15.3.1. The application was switching to background (with position correctly feeds - as expected), but never to suspended.
Now it keeps background mode for few seconds or minutes (GPS working at this moment) and then switches to suspended where no more events are triggered.
Is there any recent changes on this subject that could explain ? (that's critical for our application)
Post not yet marked as solved
Hi there,
How are we supposed to handle, when a user denies the permission request for kCLAuthorizationStatusAuthorizedAlways ? As i understand it, we don't get a direct response to requestAlwaysAuthorization, but rather we have to register a callback for locationManagerDidChangeAuthorization, which only gets called, if status is undetermined or is changed. Since we first have to request whenInUse permission with requestWhenInUseAuthorization, the status is no longer undetermined once we request always permission. Furthermore, since the "deny" option is "keep when in use permission", the actual permission is not changed if the request is denied, hence the callback won't be called. So how are we supposed to know the request was denied by the user, so we can point them towards the settings ?
A bit of context: I am developing an App in Flutter, where I need the kCLAuthorizationStatusAuthorizedAlways. For this, I use a library called permission_handler, which has native (objective c) code for iOS. Sadly, it has a bug, and since I need it to work, I am going to try to fix it myself.
Looking through the code, I suspect the problem stems from the callback not being called in the "deny" case, so I am trying to figure out how to obtain the information, that the request was denied, so I can return this information from the plugin to the FlutterEngine, where my flutter code is run.
You don't have to understand any Flutter or Dart to explain/understand this, as I just want to know how you would handle this situation in a native iOS app, so I can understand it and apply that knowledge to my flutter app/the library.
Thanks for taking the time to read my question and helping me!
Post not yet marked as solved
In the documentation it says, “If your app is terminated either by a user or by the system, the system doesn’t automatically restart your app when new location updates arrive. A user must explicitly relaunch your app before the delivery of location updates resumes. The only way to have your app relaunched automatically is to use region monitoring or the significant-change location service.”
I am interpreting that to mean that even if a user force-closes an app by swiping up in the app-switcher, that location update events should still be able to relaunch the app into the background.
Other sources such as WWDC videos mention that user killed apps will NOT refresh.
I put together a sample project to test, and so far, I am not seeing the app relaunch automatically for region monitoring or significant-change location service. Can you verify whether it should be possible or not? If it is possible, will the behavior work on a simulator or only on device? Is it different behavior per iOS version?
Post not yet marked as solved
I tried to use location manager (CLLocationManager) in a custom intent handler, so I can make some calculations based on Latitude and Longitude.
But didUpdateLocations method is never called, neither didFailWithError.
It is possible to use Location services in an intent used with Siri?