Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getInitialMedia doesn't work #339

Open
Asanas81 opened this issue Nov 13, 2024 · 0 comments
Open

getInitialMedia doesn't work #339

Asanas81 opened this issue Nov 13, 2024 · 0 comments

Comments

@Asanas81
Copy link

I have tried getInitialMedia in iOS, but it returns empty value

here is my Code try {
ReceiveSharingIntent.instance.getInitialMedia().then((List value) {
print(value.toString());
ShowDialog.showDialogTitle(context, 'Testdata15', value.toString());
WidgetsBinding.instance.addPostFrameCallback((_) {
ShowDialog.showDialogTitle(context, 'Testdata', 'content');
print('getInitialMedia');
setState(() {
_sharedFiles.clear();
_sharedFiles.addAll(value);
// print(_sharedFiles.map((f) => f.toMap()));
if (_sharedFiles.isNotEmpty) {
ShowDialog.showDialogTitle(context, 'Testdata12', _sharedFiles.first.path);
} else {
ShowDialog.showDialogTitle(context, 'Testdata13', 'empty');
}

        // Tell the library that we are done processing the intent.
        // ReceiveSharingIntent.instance.reset();
      });
    });
  });
} catch (e, stackTrace) {
  ShowDialog.showDialogTitle(context, 'Testdata7', e.toString());

  print("Error receiving shared files: $e");
  print(stackTrace);
}

the function ShowDialog.showDialogTitle returns message title (Testdata13 for example) and content (for example 'empty') , so i can test the function in Testversion,because print is not available when the app is started through shared file

class ShowDialog {
static Future showDialogTitle(BuildContext context, String title, String content) async {
return await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(title),
content: Text(content),
actions: [
TextButton(
child: Text('OK'),
onPressed: () {
Navigator.of(context).pop(); // Затваря диалога
},
),
],
);
},
);
}
}

is there any special settings for iOS to read files when the application is closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant