2014-10-10 38 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(); 
      } 

希望這會有所幫助。

相關問題