2017-08-09 84 views
3

我已經爲CallKit iOS配置了我的提供程序配置。其中我還設置了'iconTemplateImageData',用於在CallKit UI中顯示應用程序圖標。但應用圖標未顯示。它顯示一個白色方形框。應用程序圖標未在CallKit UI中顯示

enter image description here

提供配置代碼:

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()]; 

我用APPICON圖像 'Images.xcassets' 與尺寸: - 1X: 40 * 40,2倍: 80 * 80,3x: 120 * 120

請幫助爲什麼我的應用程序圖標不顯示。

在此先感謝。

+0

看到這個演示應用程序可能會幫助你:https://developer.apple.com/library/content/samplecode/Speakerbox/Introduction/Intro.html –

+0

我已經看到它。這裏他們也使用了相同的方法來設置AppIcon的配置。 Like ....... if let iconMaskImage = UIImage(named:「IconMask」){ providerConfiguration.iconTemplateImageData = UIImagePNGRepresentation(iconMaskImage) } –

+0

open var iconTemplateImageData:Data? //圖片應該是一個邊長爲40分的正方形 –

回答

1

這可能是因爲您正在使用您的AppIcon圖像,這是一個完全不透明的圖像,即該圖像的任何部分都不透明或alpha = 0。

爲了獲得理想的效果,您必須使用部分(或大部分)透明的不同圖像。原生通話用戶界面僅使用您提供的圖像的Alpha通道,因此忽略顏色。我建議按照Speakerbox示例應用中的示例進行操作,並在透明度的情況下在圖像資產目錄中提供輔助PNG圖像。

相關問題