Yauheni Pakala

Short solution for Xamarin.iOS

First, look at the work solution:

var fileUrl = NSUrl.FromFilename(...);
using var img = assetImageGenerator.CopyCGImageAtTime(...);
//...using (var dest = CGImageDestination.Create(fileUrl, UTType.PNG, 1))
{
dest.AddImage(img);
dest.Close();
}

The manual call method Close() is important!

Look at method description:

“Writes the images to the destination and disposes the object.” — Seems so

But Dispose pattern implementation doesn’t support that. Because doesn’t call Close() method.

UPD: GitHub issue: https://github.com/xamarin/xamarin-macios/issues/9058

--

--

The short note about setup Charles Proxy for iOS development.

  1. Launch Charles Proxy app.
  2. Install Charles Root Certificate:
Help → SSL Proxing → Install Charles Root Certificate on Mobile Device or Remote Browser

For Simulator use Install Charles Root Certificate in iOS Simulator

--

--

Yauheni Pakala

Yauheni Pakala

I’m a software engineer. I’m a fan of technology, web development, and programming.