Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cordova] App hanging on iOS splash screen when using CLLocationManager to range beacons #8482

Closed
KamChanLiu opened this issue Mar 14, 2017 · 3 comments

Comments

@KamChanLiu
Copy link

We have a Meteor Cordova App which uses a Cordova plugin for beacon ranging that consistently hangs on the splash screen when a beacon signal is in range. This only seems to happen when a beacon signal with a matching UUID is detected and ranged on startup.

After spending some time troubleshooting with the plugin vendor, we have managed to replicate the issue in a new, blank Meteor App (1.4.3.1) with a bare-bones Cordova plugin.

The plugin itself consists of an "iBeaconManager" class which ranges for beacons using the CLLocationManager matching UUID "b7d1027d-6788-416e-994f-ea11075f1765". This class is initialised from the AppDelegate's didFinishLaunchingWithOptions method, starting the beacon ranging.

We have tested the same plugin on a blank Cordova project with no issues on startup / splash screen load. Repository here:
https://github.com/KamChanLiu/cordova-ibeacon-bug

Please find the reproduction repository here:
https://github.com/KamChanLiu/meteor-ibeacon-bug

Reproduction Steps

A physical device is required to reproduce this issue along with a device which can emit the iBeacon signal (an iPhone, a newer Android device or a bluetooth beacon).

  1. On the beacon device, setup the beacon signal and start broadcasting as described below.
  2. Clone the repository and run for ios meteor run ios-device.
  3. Connect the other device to the development machine (ensuring Bluetooth is enabled).
  4. Start the application on the device through XCode (you may need to select a Team for code signing).
  5. App hangs on splash screen.
  • The hanging only seems to happen on the first load, after reinstalls or subsequent loads when the app has been closed for a few minutes.

  • Note that the hanging does not occur 100% of the time. Sometimes it requires the app to be killed, the device to be left to stop monitoring/ranging beacons for a few minutes, then relaunched.

Beacon device setup

For iOS, use the app BeaconBits:

  • Install the app
  • Ensure Bluetooth is switched on
  • Launch the app and select "BROADCAST"
  • Click the settings icon in the top right and ensure the UUID matches the ones being ranged in the plugin. (Default: "b7d1027d-6788-416e-994f-ea11075f1765")
  • Click Save and leave on to ensure signal is emitted

For Android, use the app Locate Beacon:

  • Install the app
  • Ensure Bluetooth is switched on
  • Launch the app and select "Beacon Transmitter"
  • Set ID1 to match the UUIDs being ranged in the plugin. (Default: "b7d1027d-6788-416e-994f-ea11075f1765")
  • Turn on the beacon transmitter

Reproducible on:

Meteor version - 1.4.3.1
Environment - macOS 10.12.3
Device - iPhone 7 iOS 10.2.1 and iPhone 6 iOS 9.2.

Any advice/guidance would be much appreciated!

@macrozone
Copy link
Contributor

@KamChanLiu

If you start the app from xcode, you can use safari to debug the webview.

See https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/GettingStarted/GettingStarted.html

This works for simulator and real devices and might help to identify javascript-errors that might prevent the app from starting up.

Also check if xcode logs an error

@KamChanLiu
Copy link
Author

Just an update to this-
We discovered that the hanging happens consistently when the app starts up in the background being triggered from beacons.

When the app is opened and debugged from Safari, we see the following error:
exception native EvalAnd Fetch : ReferenceError: Can't find variable: cordova

Other users seem to reporting similar issues without resolution:
https://forums.meteor.com/t/referenceerror-cant-find-variable-cordova/35769
https://forums.meteor.com/t/exception-nativeevalandfetch-cordova-keyboard/24751

This seems to suggest that Cordova does not get initialised properly from resuming the app in background.

Any further suggestions appreciated!

@hwillson
Copy link
Contributor

If this issue is still happening, can you try things out using a newer version of Meteor and report back? There have been updates to cordova-plugin-meteor-webapp since Meteor 1.4.3.1, that involve improving background running app support specifically. Closing for now due to the age of this issue, but let us know if this is still a problem. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants