IOS Share Sheet UIActivityViewController

I have searched the internet about a code that fires the share sheet using foreign language, I have been successful so far to do that using for android but for IOS is kinda tricky, so here is the code and if someone can help me with the code or what I am doing wrong that would be nice.

The Code:
1- MainView.ux




    
        
            var Share = require("Share");

            function share() { Share.sendIntent(); }

            module.exports = {
                share: share
            };
        

        
    



2-Share.uno


using Fuse;
using Fuse.Scripting;
using Fuse.Reactive;
using Uno.UX;

using Uno.Compiler.ExportTargetInterop;

//[ForeignInclude(Language.ObjC, "apple.UIKit.UIActivityViewController")]
//[ForeignInclude(Language.ObjC, "com.fuse.Activity")]
[UXGlobalModule]
public class Share : NativeModule
{
    static readonly Share _instance;

    public Share()
    {
        // Make sure we're only initializing the module once
        if(_instance != null) return;

        _instance = this;
        Resource.SetGlobalKey(_instance, "Share");
        AddMember(new NativeFunction("sendIntent", (NativeCallback)SendIntent));
    }

    static object SendIntent(Context c, object[] args)
    {
        SendIntent();

        return null;
    }

    [Foreign(Language.ObjC)]
    static extern(iOS) void SendIntent()
    @{

        NSString *textToShare = [NSString stringWithFormat:@"www.google.com/%@",[[NjoftimeManager getSelectedListing] objectForKey:@"_id"]];
        NSArray *itemsToShare = @[textToShare];
        UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities: nil];
        activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll]; //or whichever you don't need
        [self presentViewController:activityVC animated:YES completion:nil];
    @}
}


3- The error I am getting:


Share.uno(27.9): E3128: Call to 'Share.SendIntent(Fuse.Scripting.Context,object[])' has some invalid arguments ()
/Users/mostafa/Desktop/IOS Share/Share.uno(27,10,27,20): Error E3128: Call to 'Share.SendIntent(Fuse.Scripting.Context,object[])' has some invalid arguments ()
(1.6 s)

Build completed in 4.35 seconds
    1 error
Build ended
fuse: Failed to compile project


I know it has failed because of something wrong with my SendIntent function but basically I just want this to work so if you know more than me which I know for sure you do, I need your help to finish this thanks in advance and happy new year.

Hey!

That error appears because Uno can’t find a SendIntent that is valid on all targets. Uno instead resolves the name SendIntent to the method that you’re defining which has a different signature.

To fix it, try either changing the call to if defined(iOS) SendIntent(); or adding a static extern(!iOS) void SendIntent() { ... } function in addition to the one you have.

Yeah ok I got it the function to work however I get heaps of errors saying “self” not defined and stuff well I don’t know if the code even correct all I want is the share sheet appears with the available apps to share whatever, so if you can help me with that would be nice.

Good to hear you solved your first problem.

The next problem sounds like an issue with your Objective-C code. The error message says that self is not defined there, so you’ll have to find some other suitable object to call presentViewController on. It might work if you replace self with [[[UIApplication sharedApplication] keyWindow] rootViewController].