Geofence in Ionic not working for iOS

I used ionic geofence native plugin for Geofence and it is successfully working in Android, but it is not working for iOS. Kindly refer my below code. I can see in Xcode log geofence added successfully and monitoring location but not showing any notification.

let fence = {
id: ‘69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb’, //any unique ID
latitude: Number(this.cLatitude), //center of geofence radius
longitude: Number(this.cLongitude),
radius: this.radius, //radius to edge of geofence in meters
transitionType: 1 , //see ‘Transition Types’ below
notification: { //notification settings
id: 1, //any unique ID
title: ‘You have crossed a fence.’, //notification title
text: ‘You just left the site.’, //notification body
openAppOnClick: true //open app when notification is tapped

    () => console.log('Geofence added ios and android'),
    (err) => console.log('Geofence failed to add')

  this.geofence.onTransitionReceived().subscribe(resp => {
    console.log("resp :", resp);
    //alert("You just crossed the fence");

Have you found a solution?? I’m stuck with the same problem…

1 Like

Think the Ionic team could start prioritizing helping the community a little bit more… It’s frustrating how absent they are.

I have removed that and create fence using geolocation

Would ut be possible for you to svare the code? Ut would be to so much help.

I just used the this link for location update

Also for fence please use this method.

getDistanceFromLatLonInm(lat1,lon1,lat2,lon2) {
var R = 6371; // Radius of the earth in km
var dLat = this.deg2rad(lat2-lat1); // deg2rad below
var dLon = this.deg2rad(lon2-lon1);
var a =
Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(this.deg2rad(lat1)) * Math.cos(this.deg2rad(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2)
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c; // Distance in km
var m = d*1000;
return m;

deg2rad(deg) {
return deg * (Math.PI/180)

This doesnt really tell me much about the geofence… This just calculates the distance, right?