background_locator_fixed icon indicating copy to clipboard operation
background_locator_fixed copied to clipboard

[ios] Call back is not working in release mode

Open Faisalkc4u opened this issue 2 years ago • 13 comments

The application is working as expected in debug mode no issues are found.

But when the ios app is running on release mode, The callback is not calling from the native side. Even the example app is not working in release mode.

Faisalkc4u avatar Sep 15 '22 16:09 Faisalkc4u

also facing same issue on android.

[ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:my_test_app/location_callback_handler.dart' not found.

aaqibkhaskheli avatar Sep 19 '22 05:09 aaqibkhaskheli

also facing same issue on android.

[ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:my_test_app/location_callback_handler.dart' not found.

In Android, does same.

evaldofreu avatar Sep 19 '22 15:09 evaldofreu

Also facing same issue.

I'm forced to downgrade the Flutter version to 3.0.x to make it work. This is a temporary solution now but I am looking for a permanent solution. If someone finds a solution, please share it quickly. Thank you

as2a3 avatar Sep 20 '22 07:09 as2a3

Hi, I don't know how to make this is working So I made my own plug-in currently only in iOS available, also still in development mode But working fine for iOS

https://github.com/Faisalkc4u/bg_location_fetch

Faisalkc4u avatar Sep 20 '22 16:09 Faisalkc4u

I think we need to do like this: https://github.com/firebase/flutterfire/issues/9446#issuecomment-1240554285 but i am not sure where to add this annotation. anyone have idea ?

mohammedX6 avatar Sep 25 '22 12:09 mohammedX6

this makes me crazy ...T_T I developed all the function with this plugin and now I can't release it

kotran88 avatar Oct 04 '22 06:10 kotran88

having same issue callback_handler not found

iamwaseemsh avatar Oct 06 '22 07:10 iamwaseemsh

another solution: on your method that starts background_locater (the one that starts the Isolate), please add this annotation @pragma('vm:entry-point')

mohammedX6 avatar Oct 06 '22 08:10 mohammedX6

any updates on releasing a fix for this issue?

shantaly avatar Oct 11 '22 05:10 shantaly

Please we need an update for this issue :)

yusriltakeuchi avatar Oct 21 '22 17:10 yusriltakeuchi

another solution: on your method that starts background_locater (the one that starts the Isolate), please add this annotation @pragma('vm:entry-point')

is that in the function when i call BackgroundLocator.registerLocationUpdate() ?

yusriltakeuchi avatar Oct 21 '22 17:10 yusriltakeuchi

~~Just tested adding @pragma('vm:entry-point') on Flutter 3.3.7 it did not seem to make a difference, same error of: VERBOSE-2:shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:hero/helpers/background-location.dart' not found.~~

I think I am adding the @pragma('vm:entry-point') at the wrong place...

Wian-TMC avatar Nov 09 '22 12:11 Wian-TMC

For anyone who also runs into this issue (Please note that @pragma('vm:entry-point') works as expected):

I used my own custom callback function, meaning that @pragma('vm:entry-point') obviously needs to be added above that function, and not above the LocationCallbackHandler's callback function as provided by the example.

For clarification

await BackgroundLocator.registerLocationUpdate(
      LocationCallbackHandler.callback,
      initCallback: YOUR_CALLBACK_FUNCTION
      ...
      ...
      ...

WhereverYOUR_CALLBACK_FUNCTION is defined, it should have @pragma('vm:entry-point') above it

Wian-TMC avatar Nov 10 '22 08:11 Wian-TMC

This has been fixed in the new version 2.0.6

Yukams avatar Mar 08 '23 14:03 Yukams