Okay, I’m using the example project “Location” in the iOS examples folder.
In the Screen1 Opening Event, where it request authorization, I change AppInUse to Always:
If MyLocation.AuthorizationState = MobileLocation.AuthorizationStates.AuthorizedAlways Then
// we've got our requested authorization state, start getting LocationChanged events
myLocation.Start
Else
// we don't have authorization yet, so ask for it
myLocation.RequestUsageAuthorization(MobileLocation.UsageTypes.Always)
MyLocation.Start
End If
The iOS system message only shows that I asked for AppInFront not Always.
I click Allow while using app because Always is not an option, however, the debugger shows that the authorization state is actually Always (= 3).
I add an AuthorizationStateChanged Event to MyLocation and in that event, I add:
if state = MobileLocation.AuthorizationStates.AuthorizedAlways then
me.AllowBackgroundUpdates = True
end if
“me.AllowBackgroundUpdates = True” hard crashes in the simulator and on a device every time. No Xojo error message in the simulator crash, the app simple quits.
So it appears that I’m being even more clueless than my average state but I just don’t see where/how to use AllowBackgroundUpdates to turn on background updates.
By the way, the Visits Project in the iOS examples folder immediately crashes the simulator on launch as well without any modification. It appears to have AllowBackgroundUpdates set as well from the comments but I’m not sure where that is done.
I’m happy to report this as a bug if I’m not using it correctly but I’d like to know whether it really is a bug, first.