2014-10-10 72 views
0

我有一个用Xamarin编写的iOS应用程序。它旨在针对iOS 7.1。与SDK 8. 我的代码看起来像以下:Photo picker在一秒内显示然后消失

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张照片示于一秒,比被示出加载屏幕。

我在做什么错?我找不到任何有用的信息。

回答

0

万一别人会需要这个,https://components.xamarin.com/gettingstarted/xamarin.mobile说:

显示一个MediaPicker响应UIActionSheet.Clicked事件会导致iOS上的意外行为8.应用程序进行更新,以便有条件地使用UIAlertController与一种UIAlertControllerStyle.ActionSheet风格。

所以我编辑我的代码使用UIAlertController如果设备是在iOS 8

和它的作品。

0

我有同样的问题,我只是改变事件点击UIActionSheet解散的事件。 EJ。

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

希望这会有所帮助。