繁体   English   中英

照片选择器显示一秒钟,然后消失

[英]Photo picker shows on one second then disappears

我有一个用Xamarin编写的iOS应用程序。 它针对iOS 7.1而构建。 使用SDK8。我的代码如下:

var dialog = DialogHelper.ShowProgress(View, "Uploading");
picker.PickPhotoAsync().ContinueWith(t =>
{
  if (t.IsCanceled || t.IsFaulted)
    {
      AppDelegate.FileUploadController.IsWorking = false;
      dialog.Dismiss();
      return;
    }
  MediaFile file = t.Result;
  string filePath = file.Path;
  UploadHelper.UploadFile(filePath, _folderId, temp, dialog);

}, TaskScheduler.FromCurrentSynchronizationContext());

这在iOS 7(模拟器和设备)上都很好用,但在iOS 8上显示的照片是一秒钟,而不是显示加载屏幕。

我究竟做错了什么? 我找不到任何有用的信息来搜索它。

万一其他人需要它, https//components.xamarin.com/gettingstarted/xamarin.mobile说:

响应UIActionSheet.Clicked事件而显示MediaPicker会在iOS 8上导致意外行为。应更新应用程序,以有条件地使用UIAlertControllerStyle.ActionSheet样式的UIAlertController。

因此,如果设备在iOS 8上,我将代码编辑为使用UIAlertController。

而且有效。

我有同样的问题,我只是将事件单击更改为UIActionSheet取消的事件。 EJ。

           actionsheet.Dismissed+= delegate(object sender, UIButtonEventArgs b) {
           if(b.ButtonIndex==0){
                useCamera();
            }
            else if(b.ButtonIndex==1){
                useGallery();
            }

希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM