2

I am using Xamarin.Plugin.FilePicker to choose a file from the device.

Following is my code for picking a file from device:

var file = await CrossFilePicker.Current.PickFile();
if (file != null)
{
    filename_label.Text = file.FileName;
}

But this is not working on ios platform (Working fine on android and windows). Getting the below exception when running on ios simulator:

System.NotImplementedException has been thrown. This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.

What I am missing on the ios part? Is this package only for android and windows?

Sreejith Sree
  • 3,055
  • 4
  • 36
  • 105

2 Answers2

1

Most probably you haven't configured your iCloud Driver (CloudKit). As it states in the project's documentation:

iOS: You need to Configure iCloud Driver for your app.

You can follow the steps and everything will be working in no time. This is needed, since on iOS you don't have a "simple" file system, to choose your file from. It needs to go "through" iCloud.

Mihail Duchev
  • 4,691
  • 10
  • 25
  • 32
  • 1
    I will go through this and update the result here, thanks – Sreejith Sree Jun 02 '20 at 08:26
  • As it says here: https://learn.microsoft.com/en-gb/xamarin/ios/data-cloud/intro-to-cloudkit#the-development-and-production-environments The iOS Simulator works only with the Development Environment. When the developer is ready to test an application in a Production Environment, a physical iOS device is required. – Mihail Duchev Jun 02 '20 at 09:31
  • I have configured the CloudKit, for some reason my physical ios device is not getting connected. – Sreejith Sree Jun 02 '20 at 10:03
1

System.NotImplementedException has been thrown. This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.

The error probably caused by the version of Xamarin.Forms or Mono SDK could not match with the version of the plugin . In your case , the latest version of plugin is 2.1.41. Which is released 7 days ago . Maybe it is still a beta version when you install it . So you could uninstall it and install an older version like 2.1.34 .

Lucas Zhang
  • 18,630
  • 3
  • 12
  • 22