I’m constructing a iOS in-house Time Card app, and I added performance to trace person clock-in location. This shall be used to simply to get a fundamental thought of the place the person clocked in.
The difficulty I’m dealing with is the immediate for location entry is rarely given to the person. Which makes the placement seize at all times fail.
I’ve carried out the privateness settings for the data.plist, nevertheless, it’s nonetheless not showing.
Right here is my config.xml
WorkHour
Time Card App for BL Ductless
[email protected]" href="https://blductless.com">
BL Ductless
Your location is used to trace the place you clock-in.
Your location is used to trace the place you clock-in/work on tasks.
NSPrivacyAccessedAPITypesIdentifier
Location
NSPrivacyAccessedAPITypesPurpose
To verify appropriate location when updating time card standing (clock in, clock out, edit time card)
Am I lacking one thing? All the things I’ve learn within the documentation has proven that that is the setup required to make use of Geolocation in iOS (nevertheless outdated).
I’ve verified that the app has not beforehand requested for permission, in my settings it says “Enable location when prompted” which is meant conduct for a utility that has not but prompted for location use.
For reference, here’s a snippet of my JavaScript clock-in performance:
// Clock In.
window.clockInTime = new Date();
window.clockedIn = true;
clockBtn.innerText = "Clock Out";
doc.getElementById("statusLabel").innerText = "Clocked In";
window.timerInterval = setInterval(updateTimer, 1000);
var finalAddress = "";
navigator.geolocation.getCurrentPosition(onSuccessGetLocation, onErrorGetLocation);
operate onSuccessGetLocation(place) {
var msg =
'Latitude: ' + place.coords.latitude + 'n' +
'Longitude: ' + place.coords.longitude + 'n' +
'Altitude: ' + place.coords.altitude + 'n' +
'Accuracy: ' + place.coords.accuracy + 'n' +
'Altitude Accuracy: ' + place.coords.altitudeAccuracy + 'n' +
'Heading: ' + place.coords.heading + 'n' +
'Velocity: ' + place.coords.pace + 'n' +
'Timestamp: ' + place.timestamp;
nativegeocoder.reverseGeocode(reverseLocationSuccess, reverseLocationFailure, place.coords.latitude, place.coords.longitude, { useLocale: true, maxResults: 1 });
}
// onError Callback receives a PositionError object
//
operate onErrorGetLocation(error) {
}
operate reverseLocationSuccess(consequence) {
var firstResult = consequence[0] || {};
// extract the items you need
var avenue = firstResult.thoroughfare || '';
var metropolis = firstResult.locality || '';
var state = firstResult.administrativeArea || '';
// be part of them with commas, skipping any empty values
var formattedAddress = [street, city, state]
.filter(operate(half) { return half.size; })
.be part of(', ');
finalAddress = formattedAddress;
console.log('Formatted Deal with:', formattedAddress);
fetch("redacted", {
technique: "POST",
headers: { "Content material-Kind": "utility/json" },
physique: JSON.stringify({
employeeId: worker.id,
clockInTime: window.clockInTime.toISOString(),
projectId: projectId,
location: finalAddress
})
})
.then(r => r.json())
.then(d => console.log("Clock in recorded:", d))
.catch(e => console.error("Error clocking in:", e));
}
I tried to switch my data.plist with appropriate location permissions and utilization descriptions, ran on actual {hardware}, ran unit assessments with a check configuration with location set to a specified entry, and switched geolocation plugins.