question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug when invoking PickPhotoAsync from a UIAlertView click handler

See original GitHub issue

When 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

  1. Create an alert dialog where the click handler calls TakePhotoAsync or PickPhotoAsync
  2. Tap your button on the alert dialog and watch the problem occur.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
benevbrightcommented, Mar 28, 2017

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.

1reaction
jamesmontemagnocommented, Apr 6, 2017

Work around for ignoring alertcontrollers can be found in latest beta.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found