Closed gomazaba closed 3 years ago
When can this be merged?
@mehdok I forked and tried this fix, but I was still able to reproduce the error when changing iOS permissions from 'Allow only while using App' to 'Always allow' when prompted, the iOS app crashes on startup again and again, even with the above workaround.
It seems to crash on iOS consistently on app startup when permissions are set to 'Always allow'.
@Wian-TMC I did a little modification to this branch, I'll publish it in a few minutes, please test that to see if the problem still exists;
@Wian-TMC I did a little modification to this branch, I'll publish it in a few minutes, please test that to see if the problem still exists;
Will test again, thank a mil
@Wian-TMC
Please check the latest version 1.6.3
;
@Wian-TMC Please check the latest version
1.6.3
;
Awesome, I assume the change in android/src/main/kotlin/rekab/app/background_locator/BackgroundLocatorPlugin.kt fixed issue #252 as well?
@Wian-TMC I'm not sure exactly, please check to see if that problem is fixed or not;
@Wian-TMC I'm not sure exactly, please check to see if that problem is fixed or not;
Issue still stands.
registerLocationUpdate()
will not run unless you run unRegisterLocationUpdate()
. This is because the locator still thinks it is running in the background -> Confirmed with isServiceRunning()
, which always returns true after the above procedure.@Wian-TMC So there is not any crash, am I right? I'm aware of this malfunctioning and marked it as a bug somewhere;
The problem is I'm saving the state of the service in UserDefault
and SharedPreferences
;
I couldn't find a better way to realize whether the service is running or not (in the case of iOS there is not a service, I just have to find a way to tell if the location update started or not);
I'm open to any suggestions;
Correct, there is no crash. Just the functionality issue.
@Wian-TMC So there is not any crash, am I right? I'm aware of this malfunctioning and marked it as a bug somewhere;
The problem is I'm saving the state of the service in
UserDefault
andSharedPreferences
; I couldn't find a better way to realize whether the service is running or not (in the case of iOS there is not a service, I just have to find a way to tell if the location update started or not);I'm open to any suggestions;
Is the process running on a separate thread? Will it be possible to clear the state of the service in UserDefault
and SharedPreferences
when the thread ends or throws an exception?
@Wian-TMC I did a little modification to this branch, I'll publish it in a few minutes, please test that to see if the problem still exists;
Issue with 'Always allow' permissions is gone on iOS! Thanks so much
Is the process running on a separate thread? Will it be possible to clear the state of the service in
UserDefault
andSharedPreferences
when the thread ends or throws an exception?
No, they are not in a separate thread, But it's a really good idea. I think it is possible to do that in Android
, not sure about iOS
.
@Wian-TMC I did a little modification to this branch, I'll publish it in a few minutes, please test that to see if the problem still exists;
Issue with 'Always allow' permissions is gone on iOS! Thanks so much
@mehdok Bad news... The problem is NOT gone. It worked for a few hours, but leaving the app permissions on iOS as 'Always allow' brought the crash back. The logs are as follows:
Sending a message before the FlutterEngine has been run.
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x1a0206754 __exceptionPreprocess
1 libobjc.A.dylib 0x1b4ccd7a8 objc_exception_throw
2 CoreFoundation 0x1a01083f8 -[CFPrefsSearchListSource addManagedSourceForIdentifier:user:]
3 Foundation 0x1a14dc714 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4 Flutter 0x105eb115c (Missing)
5 background_locator 0x105cbb8fc (Missing)
6 background_locator 0x105cbc864 (Missing)
7 background_locator 0x105cbc638 (Missing)
8 background_locator 0x105cbba50 (Missing)
9 Flutter 0x105ebd15c (Missing)
10 Runner 0x1044c3674 AppDelegate.application(_:didFinishLaunchingWithOptions:) + 24 (AppDelegate.swift:24)
11 Runner 0x1044c37a8 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) (<compiler-generated>)
12 UIKitCore 0x1a2bf07a8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]
13 UIKitCore 0x1a2bf223c -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:]
14 UIKitCore 0x1a2bf8388 -[UIApplication _runWithMainScene:transitionContext:completion:]
15 UIKitCore 0x1a224bc98 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:]
16 UIKitCore 0x1a27b4f58 _UIScenePerformActionsWithLifecycleActionMask
17 UIKitCore 0x1a224c830 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke
18 UIKitCore 0x1a224c238 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
19 UIKitCore 0x1a224c640 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
20 UIKitCore 0x1a224be7c -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
21 UIKitCore 0x1a22543c0 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
22 UIKitCore 0x1a26c2970 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:]
23 UIKitCore 0x1a27cdd68 _UISceneSettingsDiffActionPerformChangesWithTransitionContext
24 UIKitCore 0x1a22540b8 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
25 UIKitCore 0x1a207bfa0 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
26 UIKitCore 0x1a207a920 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
27 UIKitCore 0x1a207bbc8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
28 UIKitCore 0x1a2bf6528 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:]
29 UIKitCore 0x1a26ebfd0 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]
30 FrontBoardServices 0x1af7985d8 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:]
31 FrontBoardServices 0x1af7c3d44 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.200
32 FrontBoardServices 0x1af7a76a4 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
33 FrontBoardServices 0x1af7c3a0c __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke
34 libdispatch.dylib 0x19fdf381c _dispatch_client_callout
35 libdispatch.dylib 0x19fdf730c _dispatch_block_invoke_direct
36 FrontBoardServices 0x1af7ebfa0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
37 FrontBoardServices 0x1af7ebc30 -[FBSSerialQueue _targetQueue_performNextIfPossible]
38 FrontBoardServices 0x1af7ec184 -[FBSSerialQueue _performNextFromRunLoopSource]
39 CoreFoundation 0x1a01809e8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
40 CoreFoundation 0x1a01808e4 __CFRunLoopDoSource0
41 CoreFoundation 0x1a017fbe8 __CFRunLoopDoSources0
42 CoreFoundation 0x1a0179bc8 __CFRunLoopRun
43 CoreFoundation 0x1a0179360 CFRunLoopRunSpecific
44 GraphicsServices 0x1b77b7734 GSEventRunModal
45 UIKitCore 0x1a2bf4584 -[UIApplication _run]
46 UIKitCore 0x1a2bf9df4 UIApplicationMain
47 Runner 0x1044c3a70 main + 15 (AppDelegate.swift:15)
48 libdyld.dylib 0x19fe35cf8 start
@mehdok Should I open a new issue regarding the above, seeing as this one has been merged?
@Wian-TMC Sure, please do that and provide all the information available;
i have same problem as #237
iOS devices. background_locator: 1.6.0+1-beta flutter: 2.2.1
sometimes, app crash when launched.
I think it happened because the plugin was calling FlutterMethodChannel during the initialization of the flutter engine.
FlutterEngine.mm#L798-L799
so, I changed to ignore that exception.