Receive multiple files selected (copy to X app)

ivnoxamivnoxam Member ✭✭

Hi! I got a problem with my app. I can successfully receive one file when a user uses my application to share with. It's done with openURL method, defined in the AppDelegate of my application.

However, this doesn't work with multiple files selected. When a user selects more than one file to share. the application still fires the openURL method, but only returns the url from the first selected (openURL doesn't have an array option), and the others just get lost in the way. I did it for Android with Intents and it works really good, even for multiple selection, but i can't make it work on iOS.

Is there any workaround to make this work or i am doing it wrong?

Thanks in advance!

Tagged:

Answers

  • JuniorJiangJuniorJiang Member, Xamarin Team Xamurai

    Hi, which ways you use to share files?You can post some code about this.

  • ivnoxamivnoxam Member ✭✭

    Hi! Of course. These are on my AppDelegate.

    public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
    {
    return openLink(url);
    }

    private bool openLink(NSUrl url)
    {
    string filePath = url.AbsoluteString.Substring(7);
    var fileName = url.PathComponents[url.PathComponents.Length - 1];
    //...
    }

    This code works sending ("Copy to Myapp") one file to the application. When I select and send multiple files to the application, the method is called but only with the first file URL, the other just get lost. I need something similar to Android IntentFilter * / * with multiple files (I got no problem with Android).

    Thanks in advance!

  • ivnoxamivnoxam Member ✭✭

    Up! :)

  • ivnoxamivnoxam Member ✭✭

    Up! Anyone?

Sign In or Register to comment.