I am developing an application to modify my contact with expo-contact. When I do I get the following error: [Unhandled promise rejection: Error: Failed to get permissions]
Hey @drabom123, on what platform is this happening? Also, please share the code you’ve implemented. Without code and more information, it’s nearly impossible to help debug. The more information you can share when asking for help, the better equipped potential responders will be to help.
Cheers,
Adam
I work on client expo
contact content
import { StyleSheet, View, Text } from 'react-native';
import * as Contacts from 'expo-contacts';
import {VerificationMobile} from './VerificationContact/verificationMobile'
import {VerificationFixe} from './VerificationContact/verificationFixe'
import {SauvegarderContact} from './SauvegarderContact'
export function ListeContact() {
(async () => {
const { status } = await Contacts.requestPermissionsAsync();
if (status === 'granted') {
const { data } = await Contacts.getContactsAsync({
fields: [Contacts.Fields.PhoneNumbers],
});
if (data.length > 0) {
const contact = data;
for(x in data)
{
for(y in data[x]['phoneNumbers'])
{
let number=data[x]['phoneNumbers'][y]['number']
let numeroCnnverti =VerificationMobile(number)
if(!numeroCnnverti)
{
numeroCnnverti =VerificationFixe(number)
if(numeroCnnverti)
{
data[x]['phoneNumbers'][y]['number']=numeroCnnverti
SauvegarderContact(data[x])
}
}
else {
data[x]['phoneNumbers'][y]['number']=numeroCnnverti;
SauvegarderContact(data[x])
}
}
}
}
}
})();
}
save content
import React from 'react';
import Contacts from 'react-native-contacts';
import { PermissionsAndroid } from 'react-native';
export function SauvegarderContact(data){
await Contacts.updateContactAsync(data);
}
Thanks for your help
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.