Xamarin Photo Project Extension help on how to implement GetSupportedProjectTypes

equinox2kequinox2k USMember ✭✭

In order to help community I have created a Photo Project Extension application due to Xamarin currently not providing functionality.

github.com/equinox2k/XamarinMacPhotoProjectExtension/tree/master

How ever I am stuck on how to return GetSupportedProjectTypes any help appreciated

    // This is not being called for some reason... what is this... PHProjectExtensionController_Extensions.GetSupportedProjectTypes(this);
    public PHProjectTypeDescription[] GetSupportedProjectTypes()
    {
        PHProjectTypeDescription desc = new PHProjectTypeDescription((NSString)"PHProjectTypeUndefined", "my title", "my desc", null);

        var types = new PHProjectTypeDescription[] { desc };
        // Fill the array with PHProjectTypeDescription instances representing you project types.
        // If you don't want to support custom project types set PHProjectExtensionDefinesProjectTypes to NO in the extension's Info.plist NSExtensionAttributes dictionary.
        return types;
    }

Posts

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    The problem is that you are not [Export]ing your IPHProjectExtensionController items here:

    https://github.com/equinox2k/XamarinMacPhotoProjectExtension/blob/master/PhotoProjectExtension/PhotoProjectViewController.cs

    If in VSfM you type override and start typing the name, it should let you complete an override for the interface method with the export tag built in.

    If you are interested in the technical details on why I can go into them.

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    It'll look like this:

    https://github.com/xamarin/xamarin-macios/blob/master/src/photosui.cs#L155

    without ArgumentSemantic bit.

  • equinox2kequinox2k USMember ✭✭
    edited November 6

    @ChrisHamons said:
    It'll look like this:

    github.com/xamarin/xamarin-macios/blob/master/src/photosui.cs#L155

    without ArgumentSemantic bit.

    I updated to

        [Export("supportedProjectTypes")]
        public PHProjectTypeDescription[] GetSupportedProjectTypes()
        {
            PHProjectTypeDescription desc = new PHProjectTypeDescription((NSString)"PHProjectTypeUndefined", "my title", "my desc", null);
    
            var types = new PHProjectTypeDescription[] { desc };
            // Fill the array with PHProjectTypeDescription instances representing you project types.
            // If you don't want to support custom project types set PHProjectExtensionDefinesProjectTypes to NO in the extension's Info.plist NSExtensionAttributes dictionary.
            return types;
        }
    

    The app is now behaving differently as if it is now calling the method but reports "Failed to load supported project types."

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    That sounds like are you using the API incorrectly and Apple is reporting it back to you.

    I would consider finding a sample using PhotoUI and seeing how they use the API in question. The Apple documentation (https://developer.apple.com/documentation/photosui/phprojecttypedescription) is non-existant for that specific member.

Sign In or Register to comment.