Requirement: I save some contacts in the user's iPhone along with the image (the dimensions are the same as the device). I want this image to be displayed in the FULLSCREEN field whenever a contact calls this device.
Noticed example: Truecaller iOS application appears as a red image when the caller is identified as spam
Code: This is the code that I used to save contact data. I am using Contacts.framework
CNMutableContact *newContact = [CNMutableContact new]; newContact.imageData = UIImagePNGRepresentation([UIImage imageNamed:@"blue_bg.png"]); newContact.contactType = CNContactTypePerson; newContact.givenName = user.firstName; newContact.middleName = user.middleName; newContact.familyName = user.lastName; NSArray *numbers = [[NSArray alloc] initWithArray:@[[CNLabeledValue labeledValueWithLabel:@"Main" value:[CNPhoneNumber phoneNumberWithStringValue:user.mobileNumber.stringValue]]]]; newContact.phoneNumbers = numbers; CNContactStore *store = [CNContactStore new]; CNSaveRequest *saveReq = [CNSaveRequest new]; [saveReq addContact:newContact toContainerWithIdentifier:nil]; NSError *error = nil; [store executeSaveRequest:saveReq error:&error]; if (error) { NSLog(@"Contact Save ERROR: %@", error.localizedDescription); }
Current scenario: I get this image in the iOS Contacts App , but it does not appear when this user calls the iPhone. How does Truecaller do this? What am I missing here?
ios objective-c iphone
Nishant
source share