Mr Anoimus Mr Anoimus - 4 months ago 24x
iOS Question

Getting Last Image of Album using Xamarin.IOS

I'm trying to get the last image from the album and share it on social media but whenever I tried searching for solutions, they are all either in Objective-C or Swift and I don't really understand either of the language.

I searched for solutions and got this which is in Objective-C:
Get last image from

and I have problems trying to convert the code myself from Objective-C to C# in Xamarin.IOS

The main problem that I got stuck with when converting is this line

fetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];

I could not find sortDescriptorWithKey anywhere in Xamarin.IOS


It is in the constructor according to the documentation:

so something like:

fetchOptions.SortDescriptors = new NSSortDescriptor[] {new NSSortDescriptor("creationDate", false)};