xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.45k stars 511 forks source link

InvalidOperationException when using PresentLimitedLibraryPickerAsync #13854

Open dimonovdd opened 2 years ago

dimonovdd commented 2 years ago

Steps to Reproduce

Invoke:

await PHPhotoLibrary.SharedPhotoLibrary.PresentLimitedLibraryPickerAsync(Platform.GetCurrentUIViewController());

Or:

await PHPhotoLibrary_PhotosUISupport.PresentLimitedLibraryPickerAsync(
    PHPhotoLibrary.SharedPhotoLibrary,
    Platform.GetCurrentUIViewController())

When PHAuthorizationStatus is Limited

Expected Behavior

Appearance of a pop-up window and waiting for user actions.

Actual Behavior

https://user-images.githubusercontent.com/59065470/150633976-cebd41c6-3eb0-4892-90d5-b996b6aceafe.MP4

Environment

aboutVS4Mac.txt

Logs

crash1.log crash2.log

System.InvalidOperationException: at System.Threading.Tasks.TaskCompletionSource`1[TResult].SetResult (TResult result) [0x00009] in :0 at PhotosUI.PHPhotoLibrary_PhotosUISupport+<>c__DisplayClass3_0.b_0 (System.String[] obj) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/PhotosUI/PHPhotoLibrary_PhotosUISupport.g.cs:104 at ObjCRuntime.Trampolines+SDActionArity1V5.Invoke (System.IntPtr block, System.IntPtr obj) [0x00016] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/ObjCRuntime/Trampolines.g.cs:21418 at at (wrapper native-to-managed) ObjCRuntime.Trampolines+SDActionArity1V5.Invoke(intptr,intptr) at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:83 at Samples.iOS.Application.Main (System.String[] args) [0x00001] in /Users/dmitriidimov/Documents/projects/Essentials/Samples/Samples.iOS/Main.cs:9

Example Project

See that Pull Request to Essentials

mandel-macaque commented 2 years ago

I'll take al look ASAP

dimonovdd commented 2 years ago

@mandel-macaque hi. Are there any updates?