Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Application crashes when picking file from OneDrive on iOS #74

Closed
Najdan opened this issue Aug 8, 2018 · 15 comments
Closed

Application crashes when picking file from OneDrive on iOS #74

Najdan opened this issue Aug 8, 2018 · 15 comments

Comments

@Najdan
Copy link

Najdan commented Aug 8, 2018

Expected Behavior

Picking file from OneDrive makes it available in the app.

Actual Behavior

Picking file from OneDrive crashes the app.

Steps to Reproduce the Problem

  1. Open app
  2. Tap on button to choose file
  3. Select OneDrive option
  4. Pick file from OneDrive
  5. App crashes

Specifications

  • NuGet package version: 2.0.64-beta
  • Platform(s): Xamarin.Forms (Android + iOS), crashes on iOS
  • iOS Version: 10.3.1

Stack trace log

at Plugin.FilePicker.FilePickerImplementation.DocumentPicker_DidPickDocument (System.Object sender, UIKit.UIDocumentPickedEventArgs e) [0x00022] in <a3d319ef1c324f9db6a5df5f1fe3fb3c>:0 
at UIKit.UIDocumentPickerViewController+_UIDocumentPickerDelegate.DidPickDocument (UIKit.UIDocumentPickerViewController controller, Foundation.NSUrl url) [0x00011] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIDocumentPickerViewController.g.cs:312 
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:79 
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:63 
at XamarinTest.iOS.Application.Main (System.String[] args) [0x00001] in /Users/najdan.tomic/Repositories/XamarinTest/XamarinTest.iOS/Main.cs:17 

Additional details

Tried to pick different types of documents (pdf, jpg, png) they all reproduce crash. Other cloud services like iCloud, DropBox does not have that issue.

@vividos
Copy link
Collaborator

vividos commented Oct 26, 2018

We just released a new NuGet package 2.0.106-beta. Can you reproduce this issue with the new version? I tested on iOS and couldn't reproduce this issue. If it still crashes, can you run the Sample project that is included in this repository if it also happens? And on what line the crash occurs? Thanks!

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

@vividos I will test it as soon as I manage to start Visual Studio again, I've just updated it to latest version and it crashed during restarting and now app is damaged.

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

@vividos Instead of crash, app is displaying error message "Object reference not set to an instance of an object". It may be related to either iOS 10.3.1 or OneDrive itself.

@vividos
Copy link
Collaborator

vividos commented Oct 26, 2018

Can you reproduce the exception using the sample project in this GitHub repository? Can you give us the details of the exception, e.g. ex.StackTrace or ex.ToString()? When compiling for yourself, you should see the exact line numbers where it crashed. Thanks!

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

Had some troubles configuring code signing but here is what is sample app showing when trying to pick any file from OneDrive.

Error message:

System.NullReferenceException: Object reference not set to an instance of an object
  at Plugin.FilePicker.FilePickerImplementation.DocumentPicker_DidPickDocument (System.Object sender, UIKit.UIDocumentPickedEventArgs e) [0x00026] in /Users/najdan.tomic/Downloads/FilePicker-Plugin-for-Xamarin-and-Windows-develop/src/Plugin.FilePicker/Plugin.FilePicker.iOS/FilePickerImplementation.cs:52 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <7d5a05cfcb09432d8cc656b9d781e54b>:0 
  at Plugin.FilePicker.FilePickerImplementation+<PickFile>d__10.MoveNext () [0x00026] in /Users/najdan.tomic/Downloads/FilePicker-Plugin-for-Xamarin-and-Windows-develop/src/Plugin.FilePicker/Plugin.FilePicker.iOS/FilePickerImplementation.cs:98 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <7d5a05cfcb09432d8cc656b9d781e54b>:0 
  at Plugin.FilePicker.Sample.Forms.MainPage+<PickAndShowFile>d__3.MoveNext () [0x000f8] in /Users/najdan.tomic/Downloads/FilePicker-Plugin-for-Xamarin-and-Windows-develop/samples/Plugin.FilePicker.Sample.Forms/Forms/MainPage.xaml.cs:48 

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

image

image

@vividos
Copy link
Collaborator

vividos commented Oct 26, 2018

Thanks for the analysis, I'll try to fix this bug. Apparently NSData.FromUrl fails for some reason...

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

It may be related to UIDocumentPicker bug on iOS, for which I wrote solution in Swift 4. I guess it shouldn't be hard to translate it to Xamarin. Maybe that can help.

@vividos
Copy link
Collaborator

vividos commented Oct 26, 2018

Do you have DocumentPicker_DidPickDocumentAtUrls in the call stack below DocumentPicker_DidPickDocument? I always had, so that might be the difference...

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

That's iOS version specific. On iOS 10.3.1 (before iOS 11 exactly) DocumentPicker_DidPickDocumentAtUrls is not called at all, it goes directly to DocumentPicker_DidPickDocument. On iOS 11 and later it is supported to pick multiple files from Files app and that's why DocumentPicker_DidPickDocumentAtUrls delegate method was introduced and called.

@vividos
Copy link
Collaborator

vividos commented Oct 26, 2018

It seems it's related to iOS 10. Can you change the code to this line?
NSData.FromUrl(e.Url.AbsoluteUrl)
Thanks!

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

image

image

Still same, interesting part is that picking files from Dropbox is working without issues.

@vividos
Copy link
Collaborator

vividos commented Oct 26, 2018

I can't find an iOS 10 device right now, so I can't reproduce the issue live. Maybe you can find a fix for this case...

@Najdan
Copy link
Author

Najdan commented Oct 26, 2018

Will check if I have more time, and device ofc 😃 . Not developing in Xamarin anymore (was just testing technology), this issue only happens with OneDrive and iOS 10 for me, other cloud services works normally.

vividos added a commit that referenced this issue Oct 28, 2018
@vividos
Copy link
Collaborator

vividos commented Oct 28, 2018

I now documented the behavior of iOS in the README so that other users don't fall into the same trap. This bug was also discussed in #87. The outcome is that as soon as PickFile() returns, the file should be copied somewhere or the data should be accessed by getting DataBytes or calling GetStream().

@vividos vividos closed this as completed Oct 28, 2018
jfversluis pushed a commit that referenced this issue Oct 30, 2018
* Added support for file types across platforms (#26)

* Added support for file types across platforms

- Added per platform file type support, so you can specify what kind of files you want the picker to support
- Updated iOS's picker to use the non-deprecated `UIDocumentPickerViewController`
- Minor tweaks, such as package updates

* Fixed an issue with the iOS implementation, where the returned path wasn't properly formatted/absolute, which in turn meant that the path wasn't valid as is.

* A few iOS specific improvements

* Get latest changes to master (#51)

* pull master into develop before merging back (#47)

* Resolved issues with referencing from NuGet package (#29)

Simplified the nuspec file to work with wildcards and fixed macOS assembly name.
Also added development NuGet feed to readme along with some other tweaks

* Project fixes (#35)

* fixed paths to NuGet packages folder; always relative to the .sln file

* converted samples solution file to VS 2017 and fixed "Deploy" flag for Android app

* ignore Android Resource designer generated files

# Conflicts:
#	.gitignore

* changes automatically applied by VS 2017 when opening iOS project file

* Added issue template

* fixes crash in Xamarin.Forms sample when user doesn't select file; also added example code in README file (#50)

* fixed picking files from the download folder; on newer devices the document ID may not be a number, but the real filename prefixed with "raw:" (#49)

* Updated dependencies

* Revert "Fixed Path" (#65)



* Revert "Fixed Path (#54)"

* when opening files with the sample app, ignore if filename extension is uppercase or lowercase

* removed unused method DidPickDocumentPicker() in iOS implementation

* added troubleshooting chapter to readme with common errors and their solutions

* updated sample projects to use PackageReference to reference NuGet packages

* removed obsolete project property AndroidUseLatestPlatformSdk and set target framework to Android 9.0 (API 28)

* updated Plugin.FilePicker.UWP to use PackageReference

* removed obsolete property AndroidUseLatestPlatformSdk and target Android 9.0, in Plugin.FilePicker.Android project

* updated sample projects to use Xamarin.Forms 3.3.0 NuGet package

* updated UWP project to latest stable UWP NuGet package

* fixed Android sample project by re-adding Xamarin.Forms NuGet package

* added UWP sample project

* find correct view controller to present document picker, by finding currently presented view controller

* Android: return from task with Exception that was thrown during file picking

before that, the caller only got a null FileData object without knowing what happened

* Android: also pass exception to task when setting up picking

* iOS: pass exceptions in DocumentPicker handler to picker task

* renamed Forms project folder to a shorter name and renamed the only page to MainPage

* added try-catch to call to PickFile() in order to display exceptions from picking

* delete Resource.designer.cs file from repository that is being regenerated by the compiler

* converted Xamarin.Forms sample project to use Project Sdk style .csproj proect file

* added second button to samples to pick image files

* added check if Android permission was granted

* fix android mime types implementation (#85)

(cherry picked from commit 04a5292)

* added explanation for requesting permissions on Android (#89)

* fixed exception when trying to pick a downloaded file; the Android DownloadManager won't return an actual file path; downloaded files can only be resolved using ContentResolver (#86)

* added solution folders to organize projects

* added UTType.Image file types value for picking on iOS

* Forms sample project can use .NET Standard 1.0; no need for version 2.0, which might not be installed

* added README.md for samples folder

* added Plugin.Permissions NuGet package to sample project, in order to check for permissions

* added checking Storage permission when on Android device

* iOS: simplified getting filename from pathname

* iOS: fixed getting pathname from FileUrl (fix of PR #54 that was reverted in PR #65); tested on iOS 11 device

* added documentation about FileData class to README

* Fix FileName for Mac

FileName on Mac returned the path instead.

* Fix OpenFile for Mac

* fixed getting path from OneDrive (#79)

the content provider only returned a relative filename in the data column, so it's better to use the content:// uri to access the file

* fixed indentation of release notes text in .nuspec - it should look nice on the nuget.org page now

* Android: file bytes are not read directly after picking, but only when FileData.DataArray is accessed or FileData.GetStream() is called; this fixes accessing large files that wouldn't fit in the device's memory, e.g. videos (#38)

* iOS: also removed getting data bytes when it's not used in FilePickerEventArgs

* added a troubleshooting section to explain why picked files on iOS may be gone after some time (#87, #74)

* added SourceLink integration, see https://github.com/dotnet/sourcelink

* added documentation for method PickFile(), in order to document how to use allowedTypes (#59)

* Revert "added SourceLink integration, see https://github.com/dotnet/sourcelink"

This reverts commit 1ca5796.

* documented classes in Plugin.FilePicker.Abstractions and fixed line endings
jfversluis pushed a commit that referenced this issue Nov 2, 2018
* Added support for file types across platforms (#26)

* Added support for file types across platforms

- Added per platform file type support, so you can specify what kind of files you want the picker to support
- Updated iOS's picker to use the non-deprecated `UIDocumentPickerViewController`
- Minor tweaks, such as package updates

* Fixed an issue with the iOS implementation, where the returned path wasn't properly formatted/absolute, which in turn meant that the path wasn't valid as is.

* A few iOS specific improvements

* Get latest changes to master (#51)

* pull master into develop before merging back (#47)

* Resolved issues with referencing from NuGet package (#29)

Simplified the nuspec file to work with wildcards and fixed macOS assembly name.
Also added development NuGet feed to readme along with some other tweaks

* Project fixes (#35)

* fixed paths to NuGet packages folder; always relative to the .sln file

* converted samples solution file to VS 2017 and fixed "Deploy" flag for Android app

* ignore Android Resource designer generated files

# Conflicts:
#	.gitignore

* changes automatically applied by VS 2017 when opening iOS project file

* Added issue template

* fixes crash in Xamarin.Forms sample when user doesn't select file; also added example code in README file (#50)

* fixed picking files from the download folder; on newer devices the document ID may not be a number, but the real filename prefixed with "raw:" (#49)

* Updated dependencies

* Revert "Fixed Path" (#65)



* Revert "Fixed Path (#54)"

* when opening files with the sample app, ignore if filename extension is uppercase or lowercase

* removed unused method DidPickDocumentPicker() in iOS implementation

* added troubleshooting chapter to readme with common errors and their solutions

* updated sample projects to use PackageReference to reference NuGet packages

* removed obsolete project property AndroidUseLatestPlatformSdk and set target framework to Android 9.0 (API 28)

* updated Plugin.FilePicker.UWP to use PackageReference

* removed obsolete property AndroidUseLatestPlatformSdk and target Android 9.0, in Plugin.FilePicker.Android project

* updated sample projects to use Xamarin.Forms 3.3.0 NuGet package

* updated UWP project to latest stable UWP NuGet package

* fixed Android sample project by re-adding Xamarin.Forms NuGet package

* added UWP sample project

* find correct view controller to present document picker, by finding currently presented view controller

* Android: return from task with Exception that was thrown during file picking

before that, the caller only got a null FileData object without knowing what happened

* Android: also pass exception to task when setting up picking

* iOS: pass exceptions in DocumentPicker handler to picker task

* renamed Forms project folder to a shorter name and renamed the only page to MainPage

* added try-catch to call to PickFile() in order to display exceptions from picking

* delete Resource.designer.cs file from repository that is being regenerated by the compiler

* converted Xamarin.Forms sample project to use Project Sdk style .csproj proect file

* added second button to samples to pick image files

* added check if Android permission was granted

* fix android mime types implementation (#85)

(cherry picked from commit 04a5292)

* added explanation for requesting permissions on Android (#89)

* fixed exception when trying to pick a downloaded file; the Android DownloadManager won't return an actual file path; downloaded files can only be resolved using ContentResolver (#86)

* added solution folders to organize projects

* added UTType.Image file types value for picking on iOS

* Forms sample project can use .NET Standard 1.0; no need for version 2.0, which might not be installed

* added README.md for samples folder

* added Plugin.Permissions NuGet package to sample project, in order to check for permissions

* added checking Storage permission when on Android device

* iOS: simplified getting filename from pathname

* iOS: fixed getting pathname from FileUrl (fix of PR #54 that was reverted in PR #65); tested on iOS 11 device

* added documentation about FileData class to README

* Fix FileName for Mac

FileName on Mac returned the path instead.

* Fix OpenFile for Mac

* fixed getting path from OneDrive (#79)

the content provider only returned a relative filename in the data column, so it's better to use the content:// uri to access the file

* fixed indentation of release notes text in .nuspec - it should look nice on the nuget.org page now

* Android: file bytes are not read directly after picking, but only when FileData.DataArray is accessed or FileData.GetStream() is called; this fixes accessing large files that wouldn't fit in the device's memory, e.g. videos (#38)

* iOS: also removed getting data bytes when it's not used in FilePickerEventArgs

* added a troubleshooting section to explain why picked files on iOS may be gone after some time (#87, #74)

* added SourceLink integration, see https://github.com/dotnet/sourcelink

* added documentation for method PickFile(), in order to document how to use allowedTypes (#59)

* Revert "added SourceLink integration, see https://github.com/dotnet/sourcelink"

This reverts commit 1ca5796.

* documented classes in Plugin.FilePicker.Abstractions and fixed line endings

* added WPF sample project (#3)

* implemented FilePicker for WPF (#64)

* added detailed platforms where FilePicker can be used, in description (appears in NuGet package manager) and releaseNotes (appears on NuGet homepage)

* added more designed generated files to ignore

* forgot to add FilePicker WPF implementation to main solution

* fixed OpenFile() call with relative filename that uses wrong parent directory (#71)

* marked ReadFully() with Obsolete attribute; will be made internal in 2.1

* samples: added specifying file types for UWP platform

* added or corrected documentation

* Android: fixed stack overflow when calling OpenFile() with FileData argument
jfversluis pushed a commit that referenced this issue Nov 26, 2018
* Added support for file types across platforms (#26)

* Added support for file types across platforms

- Added per platform file type support, so you can specify what kind of files you want the picker to support
- Updated iOS's picker to use the non-deprecated `UIDocumentPickerViewController`
- Minor tweaks, such as package updates

* Fixed an issue with the iOS implementation, where the returned path wasn't properly formatted/absolute, which in turn meant that the path wasn't valid as is.

* A few iOS specific improvements

* Get latest changes to master (#51)

* pull master into develop before merging back (#47)

* Resolved issues with referencing from NuGet package (#29)

Simplified the nuspec file to work with wildcards and fixed macOS assembly name.
Also added development NuGet feed to readme along with some other tweaks

* Project fixes (#35)

* fixed paths to NuGet packages folder; always relative to the .sln file

* converted samples solution file to VS 2017 and fixed "Deploy" flag for Android app

* ignore Android Resource designer generated files

# Conflicts:
#	.gitignore

* changes automatically applied by VS 2017 when opening iOS project file

* Added issue template

* fixes crash in Xamarin.Forms sample when user doesn't select file; also added example code in README file (#50)

* fixed picking files from the download folder; on newer devices the document ID may not be a number, but the real filename prefixed with "raw:" (#49)

* Updated dependencies

* Revert "Fixed Path" (#65)



* Revert "Fixed Path (#54)"

* when opening files with the sample app, ignore if filename extension is uppercase or lowercase

* removed unused method DidPickDocumentPicker() in iOS implementation

* added troubleshooting chapter to readme with common errors and their solutions

* updated sample projects to use PackageReference to reference NuGet packages

* removed obsolete project property AndroidUseLatestPlatformSdk and set target framework to Android 9.0 (API 28)

* updated Plugin.FilePicker.UWP to use PackageReference

* removed obsolete property AndroidUseLatestPlatformSdk and target Android 9.0, in Plugin.FilePicker.Android project

* updated sample projects to use Xamarin.Forms 3.3.0 NuGet package

* updated UWP project to latest stable UWP NuGet package

* fixed Android sample project by re-adding Xamarin.Forms NuGet package

* added UWP sample project

* find correct view controller to present document picker, by finding currently presented view controller

* Android: return from task with Exception that was thrown during file picking

before that, the caller only got a null FileData object without knowing what happened

* Android: also pass exception to task when setting up picking

* iOS: pass exceptions in DocumentPicker handler to picker task

* renamed Forms project folder to a shorter name and renamed the only page to MainPage

* added try-catch to call to PickFile() in order to display exceptions from picking

* delete Resource.designer.cs file from repository that is being regenerated by the compiler

* converted Xamarin.Forms sample project to use Project Sdk style .csproj proect file

* added second button to samples to pick image files

* added check if Android permission was granted

* fix android mime types implementation (#85)

(cherry picked from commit 04a5292)

* added explanation for requesting permissions on Android (#89)

* fixed exception when trying to pick a downloaded file; the Android DownloadManager won't return an actual file path; downloaded files can only be resolved using ContentResolver (#86)

* added solution folders to organize projects

* added UTType.Image file types value for picking on iOS

* Forms sample project can use .NET Standard 1.0; no need for version 2.0, which might not be installed

* added README.md for samples folder

* added Plugin.Permissions NuGet package to sample project, in order to check for permissions

* added checking Storage permission when on Android device

* iOS: simplified getting filename from pathname

* iOS: fixed getting pathname from FileUrl (fix of PR #54 that was reverted in PR #65); tested on iOS 11 device

* added documentation about FileData class to README

* Fix FileName for Mac

FileName on Mac returned the path instead.

* Fix OpenFile for Mac

* fixed getting path from OneDrive (#79)

the content provider only returned a relative filename in the data column, so it's better to use the content:// uri to access the file

* fixed indentation of release notes text in .nuspec - it should look nice on the nuget.org page now

* Android: file bytes are not read directly after picking, but only when FileData.DataArray is accessed or FileData.GetStream() is called; this fixes accessing large files that wouldn't fit in the device's memory, e.g. videos (#38)

* iOS: also removed getting data bytes when it's not used in FilePickerEventArgs

* added a troubleshooting section to explain why picked files on iOS may be gone after some time (#87, #74)

* added SourceLink integration, see https://github.com/dotnet/sourcelink

* added documentation for method PickFile(), in order to document how to use allowedTypes (#59)

* Revert "added SourceLink integration, see https://github.com/dotnet/sourcelink"

This reverts commit 1ca5796.

* documented classes in Plugin.FilePicker.Abstractions and fixed line endings

* added WPF sample project (#3)

* implemented FilePicker for WPF (#64)

* added detailed platforms where FilePicker can be used, in description (appears in NuGet package manager) and releaseNotes (appears on NuGet homepage)

* added more designed generated files to ignore

* forgot to add FilePicker WPF implementation to main solution

* fixed OpenFile() call with relative filename that uses wrong parent directory (#71)

* marked ReadFully() with Obsolete attribute; will be made internal in 2.1

* samples: added specifying file types for UWP platform

* added or corrected documentation

* Android: fixed stack overflow when calling OpenFile() with FileData argument

* marked FileData as sealed; no use deriving from FileData

* reformatting C# files; no real code changes

- formatted files with Visual Studio editor to fix spaces and line endings
- added xml documentation
- added this. for accessing fields and properties and for calling methods
- sorted and removed unused usings

* changed sample solution configuration so that Any CPU also compiles on UWP x86 and targets iOS iPhone

* updated Resource.designer.cs file for Forms sample

* removed property FileByte from internal class FilePickerEventArgs, as it is never used

* using Intent Extra constant for passing allowed types to FilePickerActivity, instead of using nameof()

* added pull request template, adapted from the Xamarin.Forms github project

* When Android doesn't have Permission.ReadExternalStorage the App will now ask the user to grant the permission on API level >=23

* Added necessary imports

* Added requested fix of inverted if's to get the right action when permission is granted

* Added comment for REQUEST_STORAGE

* Changed variable to PascalCase

* cleaning up code from PR #109

* Revert "added checking Storage permission when on Android device"

This reverts commit 779c5a1.

* Revert "added Plugin.Permissions NuGet package to sample project, in order to check for permissions"

This reverts commit e81ed29.

* removed compiler warnings in Mac implementation

* permission READ_EXTERNAL_STORAGE is automatically added to the Android app that uses this plugin; no need to add it to AndroidManifest.xml now (#112)

* removed READ_EXTERNAL_STORE permission from sample project
jfversluis pushed a commit that referenced this issue Nov 28, 2018
* Added support for file types across platforms (#26)

* Added support for file types across platforms

- Added per platform file type support, so you can specify what kind of files you want the picker to support
- Updated iOS's picker to use the non-deprecated `UIDocumentPickerViewController`
- Minor tweaks, such as package updates

* Fixed an issue with the iOS implementation, where the returned path wasn't properly formatted/absolute, which in turn meant that the path wasn't valid as is.

* A few iOS specific improvements

* Get latest changes to master (#51)

* pull master into develop before merging back (#47)

* Resolved issues with referencing from NuGet package (#29)

Simplified the nuspec file to work with wildcards and fixed macOS assembly name.
Also added development NuGet feed to readme along with some other tweaks

* Project fixes (#35)

* fixed paths to NuGet packages folder; always relative to the .sln file

* converted samples solution file to VS 2017 and fixed "Deploy" flag for Android app

* ignore Android Resource designer generated files

# Conflicts:
#	.gitignore

* changes automatically applied by VS 2017 when opening iOS project file

* Added issue template

* fixes crash in Xamarin.Forms sample when user doesn't select file; also added example code in README file (#50)

* fixed picking files from the download folder; on newer devices the document ID may not be a number, but the real filename prefixed with "raw:" (#49)

* Updated dependencies

* Revert "Fixed Path" (#65)



* Revert "Fixed Path (#54)"

* when opening files with the sample app, ignore if filename extension is uppercase or lowercase

* removed unused method DidPickDocumentPicker() in iOS implementation

* added troubleshooting chapter to readme with common errors and their solutions

* updated sample projects to use PackageReference to reference NuGet packages

* removed obsolete project property AndroidUseLatestPlatformSdk and set target framework to Android 9.0 (API 28)

* updated Plugin.FilePicker.UWP to use PackageReference

* removed obsolete property AndroidUseLatestPlatformSdk and target Android 9.0, in Plugin.FilePicker.Android project

* updated sample projects to use Xamarin.Forms 3.3.0 NuGet package

* updated UWP project to latest stable UWP NuGet package

* fixed Android sample project by re-adding Xamarin.Forms NuGet package

* added UWP sample project

* find correct view controller to present document picker, by finding currently presented view controller

* Android: return from task with Exception that was thrown during file picking

before that, the caller only got a null FileData object without knowing what happened

* Android: also pass exception to task when setting up picking

* iOS: pass exceptions in DocumentPicker handler to picker task

* renamed Forms project folder to a shorter name and renamed the only page to MainPage

* added try-catch to call to PickFile() in order to display exceptions from picking

* delete Resource.designer.cs file from repository that is being regenerated by the compiler

* converted Xamarin.Forms sample project to use Project Sdk style .csproj proect file

* added second button to samples to pick image files

* added check if Android permission was granted

* fix android mime types implementation (#85)

(cherry picked from commit 04a5292)

* added explanation for requesting permissions on Android (#89)

* fixed exception when trying to pick a downloaded file; the Android DownloadManager won't return an actual file path; downloaded files can only be resolved using ContentResolver (#86)

* added solution folders to organize projects

* added UTType.Image file types value for picking on iOS

* Forms sample project can use .NET Standard 1.0; no need for version 2.0, which might not be installed

* added README.md for samples folder

* added Plugin.Permissions NuGet package to sample project, in order to check for permissions

* added checking Storage permission when on Android device

* iOS: simplified getting filename from pathname

* iOS: fixed getting pathname from FileUrl (fix of PR #54 that was reverted in PR #65); tested on iOS 11 device

* added documentation about FileData class to README

* Fix FileName for Mac

FileName on Mac returned the path instead.

* Fix OpenFile for Mac

* fixed getting path from OneDrive (#79)

the content provider only returned a relative filename in the data column, so it's better to use the content:// uri to access the file

* fixed indentation of release notes text in .nuspec - it should look nice on the nuget.org page now

* Android: file bytes are not read directly after picking, but only when FileData.DataArray is accessed or FileData.GetStream() is called; this fixes accessing large files that wouldn't fit in the device's memory, e.g. videos (#38)

* iOS: also removed getting data bytes when it's not used in FilePickerEventArgs

* added a troubleshooting section to explain why picked files on iOS may be gone after some time (#87, #74)

* added SourceLink integration, see https://github.com/dotnet/sourcelink

* added documentation for method PickFile(), in order to document how to use allowedTypes (#59)

* Revert "added SourceLink integration, see https://github.com/dotnet/sourcelink"

This reverts commit 1ca5796.

* documented classes in Plugin.FilePicker.Abstractions and fixed line endings

* added WPF sample project (#3)

* implemented FilePicker for WPF (#64)

* added detailed platforms where FilePicker can be used, in description (appears in NuGet package manager) and releaseNotes (appears on NuGet homepage)

* added more designed generated files to ignore

* forgot to add FilePicker WPF implementation to main solution

* fixed OpenFile() call with relative filename that uses wrong parent directory (#71)

* marked ReadFully() with Obsolete attribute; will be made internal in 2.1

* samples: added specifying file types for UWP platform

* added or corrected documentation

* Android: fixed stack overflow when calling OpenFile() with FileData argument

* marked FileData as sealed; no use deriving from FileData

* reformatting C# files; no real code changes

- formatted files with Visual Studio editor to fix spaces and line endings
- added xml documentation
- added this. for accessing fields and properties and for calling methods
- sorted and removed unused usings

* changed sample solution configuration so that Any CPU also compiles on UWP x86 and targets iOS iPhone

* updated Resource.designer.cs file for Forms sample

* removed property FileByte from internal class FilePickerEventArgs, as it is never used

* using Intent Extra constant for passing allowed types to FilePickerActivity, instead of using nameof()

* added pull request template, adapted from the Xamarin.Forms github project

* When Android doesn't have Permission.ReadExternalStorage the App will now ask the user to grant the permission on API level >=23

* Added necessary imports

* Added requested fix of inverted if's to get the right action when permission is granted

* Added comment for REQUEST_STORAGE

* Changed variable to PascalCase

* cleaning up code from PR #109

* Revert "added checking Storage permission when on Android device"

This reverts commit 779c5a1.

* Revert "added Plugin.Permissions NuGet package to sample project, in order to check for permissions"

This reverts commit e81ed29.

* removed compiler warnings in Mac implementation

* permission READ_EXTERNAL_STORAGE is automatically added to the Android app that uses this plugin; no need to add it to AndroidManifest.xml now (#112)

* removed READ_EXTERNAL_STORE permission from sample project

* fixed file mode for several files; no actual code changes

old mode: 100755, new mode 100644
changed using the commands:
git config core.filemode true
chmod -R -x .
see also: https://stackoverflow.com/questions/1257592/
git also reports some files have all their lines changed

* Update README.md

* Multi targeting (#116)

* added multi-targeting project Plugin.FilePicker

changed solution to only include one project
renamed all shared, abstraction and implementation files according to their platforms
removed platform specific .csproj files
removed AssemblyInfo.cs and resources; infos now also in .csproj
new project generated by jamesmontemagno's "Cross-Platform .NET Standard Plugin Templates" project template
see: https://marketplace.visualstudio.com/items?itemName=vs-publisher-473885.PluginForXamarinTemplates

* updated sample projects to use multi-targeting project

updated solution files with single new csproj file
replaced direct references from sample platform project to plugin platform project with reference to multi-targeting project

* made FilePickerEventArgs and FilePickerCancelledEventArgs internal

* made ReadFully() internal and removed Obsolete attribute

* Revert "Merge branch 'master' into develop"

This reverts commit ea8feba, reversing
changes made to 752f6b6.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants