Open hari-seafoodsouq opened 3 weeks ago
Can you check that iOS app has necessary permissions to write and read device storage? Try using this for IOS: logsExportDirectoryName: "${externalDirectory?.path}/MyLogs/Exported",
Can you check that iOS app has necessary permissions to write and read device storage? Try using this for IOS: logsExportDirectoryName: "${externalDirectory?.path}/MyLogs/Exported",
Hi Shubyaa,
Thanks for the response. i tried using above code it didn't work as well.
This is how the code is when the share button is clicked where it's working fine for android and in ios the file is not created in the first place.
onPressed: () async { Directory? externalDirectory; if (Platform.isIOS) { externalDirectory = await getApplicationDocumentsDirectory(); } else { externalDirectory = await getExternalStorageDirectory(); } final fileDirectory = Directory('${externalDirectory?.path}/MyLogs/Logs');
try {
final zipFilePath = "${externalDirectory?.path}/log.zip";
final zipFile = File(zipFilePath);
if (zipFile.existsSync()) {
zipFile.deleteSync();
}
await ZipFile.createFromDirectory(
sourceDir: fileDirectory, zipFile: zipFile, recurseSubDirs: true);
await Share.shareXFiles(
[XFile(zipFile.path)],
subject: 'Share log file',
text: 'Hello, check your share files!',
);
} catch (e) {
print('Error: $e');
LogHelper.logs(e.toString());
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text('Error sharing logs: $e')),
// );
}
},
Kindly help me to fix this!
I initialise as: await FlutterLogs.initLogs( logLevelsEnabled: [ LogLevel.INFO, LogLevel.WARNING, LogLevel.ERROR, LogLevel.SEVERE ], timeStampFormat: TimeStampFormat.TIME_FORMAT_READABLE, directoryStructure: DirectoryStructure.SINGLE_FILE_FOR_DAY, logFileExtension: LogFileExtension.TXT, logsWriteDirectoryName: "MyLogs", logsExportDirectoryName: "MyLogs/Exported", debugFileOperations: true, isDebuggable: true, );
I check it like this:
if (Platform.isIOS) { externalDirectory = await getApplicationDocumentsDirectory();
I get an output stating "file doesn't exist" i want to know where is it getting stored and how can we see it. It works fine on android.