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

Warning in Xcode: Contact Retrieval on Main Thread #348

Open
aliakhtar49 opened this issue Jan 29, 2025 · 0 comments
Open

Warning in Xcode: Contact Retrieval on Main Thread #348

aliakhtar49 opened this issue Jan 29, 2025 · 0 comments

Comments

@aliakhtar49
Copy link

aliakhtar49 commented Jan 29, 2025

Hi Team,

We have embedded Flutter into our existing iOS application and are currently retrieving contacts. We handle permission requests on the native side and fetch contacts using the ContactsService package. The implementation is working fine, but we are encountering the following warning in Xcode when calling:

Iterable<Contact> contacts = await ContactsService.getContacts();

Warning:
This method should not be called on the main thread as it may lead to UI unresponsiveness.

It seems that fetching contacts is being executed on the main thread, which could potentially cause performance issues. We need to ensure that this operation runs on a background thread to avoid UI freezes.

Please advise on the best approach to resolve this issue.

contacts_service: 0.6.3

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