Comment puis-je obtenir les coordonnées de l'iPad et l'utiliser dans mon application. J'utilise le code suivant et j'obtiens les détails du simulateur. Mais tout en courant dans l'IPAD je ne reçois pas l'image de contact, l'email etc. J'obtiens le numéro de téléphone correctement.détails de contact de l'ipad en utilisant l'objectif-c
ABAddressBookRef addressBook = ABAddressBookCreate();
// Get all contacts in the addressbook
NSArray *allPeople = (__bridge NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
for (id person in allPeople) {
// Get all phone numbers of a contact
ABMultiValueRef phoneNumbers = ABRecordCopyValue((__bridge ABRecordRef)(person), kABPersonPhoneProperty);
ABMultiValueRef emailaddress = ABRecordCopyValue((__bridge ABRecordRef)(person), kABPersonEmailProperty);
// If the contact has multiple phone numbers, iterate on each of them
for (int i = 0; i < ABMultiValueGetCount(phoneNumbers); i++) {
NSString *phone = (__bridge_transfer NSString*)ABMultiValueCopyValueAtIndex(phoneNumbers, i);
// Remove all formatting symbols that might be in both phone number being compared
NSCharacterSet *toExclude = [NSCharacterSet characterSetWithCharactersInString:@"/.()- +"];
phone = [[phone componentsSeparatedByCharactersInSet:toExclude] componentsJoinedByString: @""];
if ([phone isEqualToString:number]) {
NSData *contactImageData = (__bridge NSData*)ABPersonCopyImageData((__bridge ABRecordRef)(person));
NSString *mail = (__bridge_transfer NSString*)ABMultiValueCopyValueAtIndex(emailaddress, i);
NSLog(@"%@",mail);
if(mail)
{
hasEmail=TRUE;
NSLog(@"true");
}
else{
hasEmail=FALSE;
NSLog(@"false");
}
ContactImage = [[UIImage alloc] initWithData:contactImageData];
// [conImage setImage:ContactImage];
break;
break;
}
}
}
if(ContactImage)
{
[conImage setImage:ContactImage];
}
else{
NSLog(@"no image");
}
J'ai besoin pour obtenir l'image en cours d'exécution sur ipad
mon codage fonctionne correctement. Mais tout en utilisant ipad je ne reçois pas l'image et l'adresse e-mail qui est le seul problème – priya
De ce que vous pouvez obtenir l'email ID ..... – IronManGill
mais l'image? j'ai besoin d'image – priya