Studyxnet / FilePicker-Plugin-for-Xamarin-and-Windows

FilePicker Plugin for Xamarin and Windows
MIT License
74 stars 52 forks source link

CrossFilePicker doesn't work on iOS #49

Closed grammatn closed 6 years ago

grammatn commented 7 years ago

I tried to use CrossFilePicker PickFile function to choose file in my xamarin form but it doesn't work.

It said "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."

ctrippel1 commented 7 years ago

For NuGet 1.1.0: It appears (to me) to be a NuGet package problem. When I installed the package to the iOS project it located the FilePicker.dll in the 'portable...' folder. This assembly uses a compiler directive in CrossFilePicker.cs to throw the message you are seeing (i.e. this portable assembly shouldn't be used for the native projects). I believe the assembly in the MonoTouch10 folder is the correct assembly to be referenced. I've already merged the source into my project (to figure this problem out) so am not in a position to verify the assembly in the MonoTouch10 folder will actually work. (Visual Studio 2015, BTW)

Greg767 commented 7 years ago

I confirm this. You must reference manually the DLLs from the MonoTouch10 folder and the plugin will work on iOS.

ismailsameer12 commented 6 years ago

Hi Greeg767, i was tried to add reference manually in xamarin iOS but NSInternalinconsistencyexception occur. how to solve this?

Greg767 commented 6 years ago

Sorry I have no idea about that problem. I never had that one before.

ismailsameer12 commented 6 years ago

Hi Greg767, Thanks for you response,its ok

johankson commented 6 years ago

For more information, on iOS I had to change the TakeMediaAsync() method to not re-read the file again. Don't know if it's worth to do a PR since the project seems to be badly managed at the moment?

Handler = (s, e) => {
var tcs = Interlocked.Exchange(ref _completionSource, null);

 Func<Stream> streamGetter = null;
if(e.FileByte != null)
{
    streamGetter = () => new MemoryStream(e.FileByte);
}
else
{
    streamGetter = () => File.OpenRead(e.FilePath);
}

tcs?.SetResult(new FileData(e.FilePath, e.FileName, streamGetter));
jfversluis commented 6 years ago

This should now be working in this NuGet: https://www.nuget.org/packages/Xamarin.Plugin.FilePicker/1.4.0-beta

If not, please open a issue on the new repo where development will be continued: https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows/issues

lohitha123 commented 5 years ago

Hi,

It is not working in ios.

if any one got success in ios..Please post your solution

jfversluis commented 5 years ago

@lohitha123 please see #87