Mr Anoimus Mr Anoimus - 2 years ago 189
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

Answer Source

It is in the constructor according to the documentation:

so something like:

fetchOptions.SortDescriptors = new NSSortDescriptor[] {new NSSortDescriptor("creationDate", false)};
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download