Open JackBeStrong opened 4 months ago
I'd also want to add that Android works fine. It's just iOS when the app is closed, that it crashes. I feed the crash report to AI, and this is what I got:
The crash log you provided indicates that the app "Runner" encountered a segmentation fault (EXC_BAD_ACCESS) due to an invalid memory address (KERN_INVALID_ADDRESS at 0x0000000000000000). This typically happens when the app attempts to access memory that has not been allocated or is no longer valid.
Here are some key points from the crash log and potential areas to investigate:
Exception Codes:
The exception codes are 0x0000000000000001, 0x0000000000000000, indicating a segmentation fault at address 0x0000000000000000. Faulting Thread:
The crash occurred in the main thread (thread 0). The pc (program counter) value indicates the address where the crash happened: swift_getObjectType. Relevant Symbols:
swift_getObjectType: This symbol appears to be where the crash originated, which is related to Swift object type retrieval. static SwiftReceiveSharingIntentPlugin.register(with:): This method is part of the receive_sharing_intent plugin and is mentioned multiple times in the call stack. Call Stack:
The call stack shows the sequence of method calls leading to the crash. Key methods include SwiftReceiveSharingIntentPlugin.register(with:) and GeneratedPluginRegistrant.registerWithRegistry. Plugin Involvement:
The receive_sharing_intent plugin is heavily referenced in the call stack, suggesting that it might be the source of the issue. Steps to Troubleshoot: Check Plugin Registration:
Ensure that the receive_sharing_intent plugin is properly registered in the app. Verify that the plugin setup is correct in both the Dart and native code. Inspect Plugin Code:
Review the implementation of the SwiftReceiveSharingIntentPlugin and ReceiveSharingIntentPlugin classes. Look for any potential issues with memory management or improper access to objects. Verify Dependencies:
Ensure that all dependencies and plugins are up-to-date and compatible with your current Flutter and Dart versions. Debugging:
Use breakpoints and logging to trace the execution flow in the SwiftReceiveSharingIntentPlugin.register(with:) method to pinpoint where the invalid memory access occurs. Reproduce the Crash:
Try to reproduce the crash consistently by following the same steps or actions that led to the crash. This can help narrow down the exact cause. Update iOS Version:
Ensure that you are testing on a device or simulator with the latest iOS version, as there might be fixes or improvements in newer releases. By following these steps, you should be able to identify and resolve the cause of the crash in the Runner app related to the receive_sharing_intent plugin. If you need further assistance, consider reaching out to the plugin's maintainers or community for support.
So are there any solutions ?
I have the same problem. When the app is cold started, it crashes. Looking at the crash report in iOS, I found that the information indicates that the crash occurred during the app startup process, specifically when registering the SwiftReceiveSharingIntentPlugin plugin. Here is a selection of the report:
"threads" : [
{
"triggered":true,
"id":4078935,
"threadState":{
"pc":{"value":7288945876,"matchesCrashFrame":1},
...
},
"queue":"com.apple.main-thread",
"frames":[
{
"imageOffset":4316372,
"symbol":"swift_getObjectType",
"symbolLocation":40,
"imageIndex":0
},
{
"imageOffset":4467464,
"symbol":"static SwiftReceiveSharingIntentPlugin.register(with:)",
"symbolLocation":152,
"imageIndex":1
},
{
"imageOffset":336888,
"symbol":"AppDelegate.application(_:didFinishLaunchingWithOptions:)",
"symbolLocation":148,
"imageIndex":2
},
...
]
}
]
+1
How to reproduce:
I literally started a new project, just to test this out.
Now, if I swipe up, and close the app. And share the file again, the app just crashes, with the attached crash report. Runner-2024-06-30-142648.txt
What have I done wrong or is this an actual issue with the package?
Below is my dart code:
import 'package:flutter/material.dart'; import 'dart:async';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); }
class _MyAppState extends State {
late StreamSubscription _intentSub;
final _sharedFiles = [];
@override void initState() { super.initState();
}
@override void dispose() { _intentSub.cancel(); super.dispose(); }
@override Widget build(BuildContext context) { const textStyleBold = const TextStyle(fontWeight: FontWeight.bold); return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Plugin example app'), ), body: Center( child: Column( children:[
Text("Shared files:", style: textStyleBold),
Text(_sharedFiles
.map((f) => f.toMap())
.join(",\n****\n")),
],
),
),
),
);
}
}
Let me know if you need any additional information.