question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Start up and run IOS crash

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
JaimeHerecommented, Apr 3, 2019

This same issue happened to me.

I solved installing the plugin cordova-plugin-local-notification.

On iOS Devices a notification is triggered when the location is updated. It seems you need to have a way to show it or the app will crash.

0reactions
mubashir6258commented, Jan 14, 2021

hello everyone, That issue is still alive on IOS and needs to be fixed asap as i just recently implemented background-geolocation and what i noticed is i am still having that app crashing issue on debug=true

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix iPhone App Crashing on Startup: on iPad, After iOS 16.2 ...
Fix iPhone App crashing on Startup: on iPad, After iOS 16.2 Update · Restart or reboot iPhone, iPad or Hard Reset · Up-to-date...
Read more >
App crashing immediately on start up after upgrading to iOS12.
Running fine in simulator but crashes in device. No crash logs recorded. In line error shown after launching the app Thread 1: EXC_BAD_ACCESS...
Read more >
iOS development app startup crash - iphone - Stack Overflow
Shift-command-K (clean). Double check the dev account is hooked up right. Delete and reinstall the app on the device. Make sure the device...
Read more >
Crash on startup with XCode 14 / iOS 16 · Issue #10705 - GitHub
1), running an app in the iOS simulator will result in an instant crash, directly after the splash screen is shown. I first...
Read more >
No, I Swear My iOS App Doesn't Crash on Startup!
No, I Swear My iOS App Doesn't Crash on Startup! A simple lesson I learned as an enterprise architect about indie iOS game...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found