Bug when invoking PickPhotoAsync from a UIAlertView click handler
See original GitHub issueWhen calling TakePhotoAsync
or PickPhotoAsync
from inside a click hander on a UIAlertView
the UI that it brings up appears where the UIAlertView
was and the disappears after a second. Calling TakePhotoAsync
from anywhere else seems to work fine. In the code I have here PickPhotoClick
, calls PickPhotoAsync
after setting some options.
vwContent.AddGestureRecognizer (new UITapGestureRecognizer ( async gesture =>
{
// Calling this here works just fine
// await PickPhotoClick ();
var alert = new UIAlertView ();
alert.Title = "Add a photo";
alert.Message = "Choose a way to add a photo";
alert.AddButton ("Take Photo");
alert.AddButton ("Pick Photo");
alert.AddButton ("Cancel");
alert.Clicked += async (sender, e) =>
{
if (e.ButtonIndex == 1)
{
// This does not work
await PickPhotoClick ();
}
else if (e.ButtonIndex == 0)
{
// This does not work
await TakePhotoClick ();
}
};
alert.Show ();
}));
Version Number of Plugin: 2.6.2 Device Tested On: iPhone 6 plus Simulator Tested On: N/A
Expected Behavior
When calling TakePhotoAsync
or PickPhotoAsync
from a UIAlertView
click handler the ui appears full screen and is usable.
Actual Behavior
Ui appears in a small box where the alert view used to be and then disappears after a second.
Steps to reproduce the Behavior
- Create an alert dialog where the click handler calls
TakePhotoAsync
orPickPhotoAsync
- Tap your button on the alert dialog and watch the problem occur.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Category of UIAlertView need callback for alert button click ...
3)And I want to call removeNotificationObserver method when user click on any button in alertview to remove notification observer. My tried out ...
Read more >[Bug] Calling an async method after PickPhotoAsync or ...
Description. Calling an async method after PickPhotoAsync or CapturePhotoAsync sort of crashes the method. No exception is thrown, but the ...
Read more >Xamarin.iOS
Handle the pullDownToRefresh event. refreshControl.ValueChanged += refreshTable;. // Add the UIRefreshControl to the TableView. TableView.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue will affect to more people because XF 2.3.4-pre release changed to use UIAlertController from old one. My project also calls PickPhotoAsync from ActionSheet button event, and I updated to XF 2.3.4-pre6 and Gallery never showed up on iOS. It does not happened on XF 2.3.3.
Thankfully, James’ adviced putting small delay worked for workaround.
Work around for ignoring alertcontrollers can be found in latest beta.