gpt4 book ai didi

ios - 保存图片为联系人图片,来电显示

转载 作者:可可西里 更新时间:2023-11-01 03:34:55 25 4
gpt4 key购买 nike

要求:我将一些联系人连同一张图片(尺寸与设备相同)保存到用户的 iPhone 中。我希望联系人在该设备上调用时全屏显示此图片。

注意示例: Truecaller当来电者被识别为垃圾邮件

时,iOS 应用显示为红色图像

代码:这是我用来保存联系人数据的代码。我正在使用 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);
}

当前情况:我在 iOS Contacts App 中收到这张图片,但当该用户在 iPhone 上调用时它没有显示。 Truecaller 是如何做到的?我在这里错过了什么?

最佳答案

如果该图像显示在“通讯录”应用中,那么当您接到那个人的电话时,它应该会显示。

关于ios - 保存图片为联系人图片,来电显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38208946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com