istornz / flutter_live_activities

A Flutter plugin to use iOS 16.1+ Live Activities ⛹ī¸ & iPhone Dynamic Island 🏝ī¸ features
https://dimitridessus.fr/
MIT License
187 stars 56 forks source link

App Crashes when clicking on notification #43

Open Ladeed opened 1 year ago

Ladeed commented 1 year ago

App Crashes occuring when clicked on the live activity notification

mjfoxena commented 1 year ago

Clicking on the Live Activities notification crashes the app.

With below exceptions ` Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' *** First throw call stack: (0x1c3fbccb4 0x1bd0643d0 0x1c4162f84 0x1c416e4ac 0x1c3fd845c 0x1c3fd82fc 0x10d4ad228 0x1cb481320 0x1cb482eac 0x1cb4916a4 0x1cb4912f4 0x1c404bc28 0x1c402d560 0x1c40323ec 0x1ff4cf35c 0x1c63bf6e8 0x1c63bf34c 0x100d8cfb8 0x1e350adec) libc++abi: terminating due to uncaught exception of type NSException

jakublebiedzinski commented 1 year ago

Additional logs:



``` 10.10.0 - [FirebaseAnalytics][I-ACS023006] User Activity does not have Deep Link. User Activity: <NSUserActivity: 0x2836ab220>
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x19bae58a0)
    frame #0: 0x000000019bae58a0 Foundation`static Foundation.URL._unconditionallyBridgeFromObjectiveC(Swift.Optional<__C.NSURL>) -> Foundation.URL + 156
Foundation`static Foundation.URL._unconditionallyBridgeFromObjectiveC(Swift.Optional<__C.NSURL>) -> Foundation.URL:
->  0x19bae58a0 <+156>: brk    #0x1
Foundation`Foundation.URL.init(fileURLWithPath: __shared Swift.String) -> Foundation.URL:
    0x19bae58a4 <+0>:   pacibsp 
    0x19bae58a8 <+4>:   stp    x22, x21, [sp, #-0x30]!
    0x19bae58ac <+8>:   stp    x20, x19, [sp, #0x10]
Target 0: (Runner) stopped.
jakublebiedzinski commented 1 year ago

For everyone, it's connected to Facebook SDK and Facebook App Events. Update Facebook SDK for iOS to 16.1.3. It helped me.

https://github.com/facebook/facebook-ios-sdk/issues/2209

I believe this is a fix for my problem -> https://github.com/facebook/facebook-ios-sdk/commit/397e7f4f87e812a4e195e5ee3f4d6991812ab86f

Goolpe commented 1 year ago

For everyone, it's connected to Facebook SDK and Facebook App Events. Update Facebook SDK for iOS to 16.1.3. It helped me.

facebook/facebook-ios-sdk#2209

I believe this is a fix for my problem -> facebook/facebook-ios-sdk@397e7f4

Updated Facebook SDK, didn't help. I think there are different issues. I only have logs like mjfoxena, did you resolve it?

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x1b3d74cb4 0x1ace1c3d0 0x1b3f1af84 0x1b3f264ac 0x1b3d9045c 0x1b3d902fc 0x113aa5228 0x1bb239320 0x1bb23aeac 0x1bb2496a4 0x1bb2492f4 0x1b3e03c28 0x1b3de5560 0x1b3dea3ec 0x1ef2af35c 0x1b61776e8 0x1b617734c 0x104dcf90c 0x1d32eadec)
libc++abi: terminating due to uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001f2cde558 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
->  0x1f2cde558 <+8>:  b.lo   0x1f2cde578               ; <+40>
    0x1f2cde55c <+12>: pacibsp
    0x1f2cde560 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1f2cde564 <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Goolpe commented 1 year ago

This issue appears on Flutter 3.10.6. Works fine on 3.7.11

ambogatyrev commented 1 year ago

in my case, the application crashes when the live activity is swiped to close Exception from Sentry: EXC_BREAKPOINT Exception 6, Code 1, Subcode 4308798324

flutter doctor [✓] Flutter (Channel stable, 3.7.11, on macOS 13.2.1 22D68 darwin-arm64, locale ru-KZ) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.80.1) [✓] Connected device (3 available) [✓] HTTP Host Availability
Goolpe commented 1 year ago

Link(destination: URL(string: "")) addition in my extension like in example fixed an issue

@available(iOSApplicationExtension 16.1, *)
struct live_activity_testLiveActivity: Widget {
    var body: some WidgetConfiguration {
        ActivityConfiguration(for: FlutterLiveActivities.self) { context in
            let data = TestData(JSONData: context.state.data)

            // Lock screen/banner UI goes here

            VStack(alignment: .leading) {
                Text(data?.text ?? "")
                HStack {
                    // Create an action via `Link`
                    Link(destination: URL(string: "fla://xx.xx/tap/A")!) {
                        Text("A")
                            .frame(width: 40, height: 40)
                            .background(.blue)
                    }
                    // Create an action via `Link`
                    Link(destination: URL(string: "fla://xx.xx/tap/B")!) {
                        Text("B")
                            .frame(width: 40, height: 40)
                            .background(.blue)
                    }
                    // Create an action via `Link`
                    Link(destination: URL(string: "fla://xx.xx/tap/C")!) {
                        Text("C")
                            .frame(width: 40, height: 40)
                            .background(.blue)
                    }
                }
                .frame(width: .infinity, height: .infinity)
            }
            .padding(20)
            .activityBackgroundTint(Color.cyan)
            .activitySystemActionForegroundColor(Color.black)

        } dynamicIsland: { context in

            let data = TestData(JSONData: context.state.data)

            return DynamicIsland {
                DynamicIslandExpandedRegion(.bottom) {
                    // Create an action via `Link`
                    Link(destination: URL(string: "fla://xxxxxxx.xxxxxx")!) {
                        Text(data?.text ?? "")
                            .background(.red)
                    }
                }
            } compactLeading: {
                Text("L")
            } compactTrailing: {
                Text("T")
            } minimal: {
                Text("Min")
            }
            .widgetURL(URL(string: "fla://www.apple.com")) // or use widgetURL
            .keylineTint(Color.red)
        }
    }
}
istornz commented 1 year ago

Hi all! Is this issue still persists?

exiiil commented 1 year ago

for me this bug still exists. any suggestions?