-
-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
I am using Unity 6.
I have an app that downloads a transparent PNG at runtime and Decodes it as a skbitmap.
It works wonderfully on Android. Fails on IOS. No details just
Error - NDS.ExperienceATP.Services.Navigation.NavigationService.DownloadBitmapAsync[332] - Decode failure for bitmap 'https://stgasa.blob.core.windows.net/srx-sites/SaratogaMonument_CalloutA.png'
I have tried modifying the PNG to make it simpler.
No luck
Thoughts?
private async UniTask<SKBitmap> DownloadBitmapAsync(string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
throw new ArgumentException("fileName is null/empty.", nameof(fileName));
SKBitmap returnValue = null;
string url = _ConfigURL + fileName;
using (var request = UnityWebRequest.Get(url))
{
request.downloadHandler = new DownloadHandlerBuffer();
await request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
Logger.Error($"Failed downloading bitmap from '{url}' - {request.error}");
throw new Exception($"Error downloading bitmap from '{url}' - {request.error}");
}
byte[] data = request.downloadHandler.data;
if (data == null || data.Length == 0)
{
Logger.Error($"Empty bitmap data from '{url}'.");
throw new Exception($"Empty bitmap data from '{url}'.");
}
try
{
returnValue = SKBitmap.Decode(data);
}
catch (Exception ex)
{
Logger.Error($"Decode failure for bitmap '{url}'", ex);
throw new Exception($"Decode failure for bitmap '{url}'", ex);
}
if (returnValue == null)
{
Logger.Error($"Null SKBitmap after decode from '{url}'.");
throw new Exception($"Null SKBitmap after decode from '{url}'.");
}
}
return returnValue;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels