0
出於某種原因,相同的代碼我用來訪問相機和相冊所用與以往的iOS工作不工作。每當我打開相機應用程序或相冊時,應用程序崩潰,崩潰日誌上也不會顯示任何內容。我測試了它的iOS 3.0到4.1,它工作正常。這是否發生在任何人身上?這是一個錯誤?它甚至沒有使用imagePickerController方法,只要它加載相機或相冊就會崩潰。iOS 4.2的相機和相冊問題
我使用的代碼是這樣的:
#pragma mark Photo methods
- (void) getNewPhoto {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
}
- (void)loadPhotoFromLibrary {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
}
#pragma mark ImagePickerController methods
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:NO];
selectedImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
謝謝!
你知道哪條線路在撞上嗎?設置一個斷點並逐步完成。它看起來完全沒問題(格式除外)。知道它在哪裏崩潰是關鍵。至於iOS 4.2,我的代碼幾乎與您的代碼完全相同,並且工作正常。 – 2010-12-03 12:54:14