App icon is not showing in CallKit UI

Viewed 4889

I have configured my Provider Configuration for CallKit iOS. In which I have also set 'iconTemplateImageData' for displaying app icon in CallKit UI. But app icon is not showing. It shows a white square box.

enter image description here

Provider Configuration Code:

    CXProviderConfiguration *configuration = [[CXProviderConfiguration alloc] initWithLocalizedName:[NSString stringWithFormat:@"%@\n", _title]];
    configuration.maximumCallGroups = 1;
    configuration.maximumCallsPerCallGroup = 1;
    UIImage *callkitIcon = [UIImage imageNamed:@"AppIcon"];
    configuration.iconTemplateImageData = UIImagePNGRepresentation(callkitIcon);

    _callKitProvider = [[CXProvider alloc] initWithConfiguration:configuration];
    [_callKitProvider setDelegate:self queue:nil];

    _callKitCallController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()];

I have used AppIcon images in 'Images.xcassets' with sizes: - 1x: 40*40, 2x: 80*80, 3x: 120*120

Please help why my app icon is not showing.

Thanks in advance.

2 Answers

You need to use below code in order to set app name and app icon for incoming VOIP calls

let localizedName = NSLocalizedString("App-Name", comment: "Name of application")
let providerConfiguration = CXProviderConfiguration(localizedName: localizedName)
providerConfiguration.iconTemplateImageData = UIImage.init(named: "appicon-Name")?.pngData()

Note: Your app icon must be transparent. result will be like in below image

enter image description here

Related