2014-11-08 106 views
0

出於某種原因,我在IOS應用程序中獲取空圖像,無論是拍照還是抓取圖庫中的照片。它正在工作並將照片返回給我的視圖控制器,然後突然停止工作,即使我沒有對該程序進行任何更改。這是由內存問題引起的嗎?如果我通過該程序拍攝照片,它會將照片放到圖庫中,但不會將其返回到視圖控制器。任何想法可能是什麼問題?下面是我達到照片邏輯:IOS相機停止工作

- (IBAction)getPhoto:(id)sender { 

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 

imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
[imagePicker setDelegate:self]; 
[self presentViewController:imagePicker animated:YES completion:nil]; 
} 

以下是我回報的邏輯被選中後的照片,並返回一個空的圖像:

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
    { 

    UIImage *image = (UIImage *) [info objectForKey: 
      UIImagePickerControllerOriginalImage]; 

self.photoImage.image = image; 
self.uploadImage = image; 
[self dismissViewControllerAnimated:YES completion:nil]; 
} 
+0

即使重新啓動應用程序後,這種情況是否發生? – 2014-11-08 05:41:10

+0

如果這是您重新啓動應用程序的意思,我在Iphone上重新運行該應用程序。它每次運行時都會繼續發生。我應該從手機上刪除應用程序並重試嗎? – Dave 2014-11-08 15:45:28

回答

0

對不起,FLASE報警,但我發現我的形象去在我的xib文件中。一旦我恢復它的工作。我不明白爲什麼IOS在嘗試更新時沒有檢測到丟失的圖像。