Skip to content

Start up and run IOS crash #565

@KongGeJian

Description

@KongGeJian

Your Environment

  • Plugin version:3.0.3
  • Platform: iOS
  • OS version:12.1
  • Device manufacturer and model: iPhone 6s plus
  • Running in Simulator: Yes
  • Cordova version (cordova -v): 9.0.0
  • Cordova platform version (cordova platform ls):5.0.0
  • Plugin configuration options:
  • Link to your project:

Context

  this.platform.ready().then(() => {
    this.init();
  });
  // init bg-geo
  init() {
    const config: BackgroundGeolocationConfig = {
      desiredAccuracy: 10,
      stationaryRadius: 1, 
      distanceFilter: 1,
      maxLocations: 10,
      debug: true,
      stopOnTerminate: false
    };
    this.backgroundGeolocation.configure(config)
      .then(() => {
        this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location) => {
           this.logger.info(location);
        });
      });
    this.backgroundGeolocation.start();
 }

Expected Behavior

App runs normally, running location monitoring

Actual Behavior

After init background-geolocation,this is run 'start()'. App crash.

2019-04-01 10:16:32.585834+0800 TimeStory[6768:1623947] CDVBackgroundGeolocation #start
2019-04-01 10:16:32.586395+0800 TimeStory[6768:1624020] BgGeo #start: 0
2019-04-01 10:16:32:586 TimeStory[6768:1624018] BgGeo #start: 0
2019-04-01 10:16:32:589 TimeStory[6768:1623947] DistanceFilterLocationProvider iOS9 detected
2019-04-01 10:16:32.604441+0800 TimeStory[6768:1624020] DistanceFilterLocationProvider will start
2019-04-01 10:16:32:589 TimeStory[6768:1623947] DistanceFilterLocationProvider will start
2019-04-01 10:16:32.612263+0800 TimeStory[6768:1623947] CDVBackgroundGeolocation #onAuthorizationChanged
2019-04-01 10:16:32.612993+0800 TimeStory[6768:1624020] DistanceFilterLocationProvider switchMode 1
2019-04-01 10:16:32:592 TimeStory[6768:1623947] DistanceFilterLocationProvider switchMode 1
2019-04-01 10:16:32.630591+0800 TimeStory[6768:1624021] LocationManager didChangeAuthorizationStatus 4
2019-04-01 10:16:32:609 TimeStory[6768:1623947] LocationManager didChangeAuthorizationStatus 4
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.

Possible Fix

Recursive callbacks occur here, and the comments run correctly.

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
       willPresentNotification:(UNNotification *)notification
         withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
    if (prevNotificationDelegate && [prevNotificationDelegate respondsToSelector:@selector(userNotificationCenter:willPresentNotification:withCompletionHandler:)])
    {
        // Give other delegates (like FCM) the chance to process this notification
//        [prevNotificationDelegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:^(UNNotificationPresentationOptions options) {
//            completionHandler(UNNotificationPresentationOptionAlert);
//        }];
    }
    else
    {
        completionHandler(UNNotificationPresentationOptionAlert);
    }
}

Steps to Reproduce

Context

Debug logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleauto labeled abandoned issues after a period of inactivity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions