J'essaie d'écrire une application, mais elle plante constamment lorsque j'utilise uiimagepickercontroller. Je pensais que c'était peut-être parce que je ne disposais pas du sélecteur après chaque utilisation, mais il gèle aussi souvent au premier passage. Habituellement, je prends une photo et elle se fige, ne demandant jamais à "utiliser" l'image.UIImagePickerController Crashing Monotouch
Avez-vous des suggestions? Voici mon code. Est-ce que quelqu'un a eu ça pour travailler?
public override void ViewDidLoad()
{
base.ViewDidLoad();
myPicker = new UIImagePickerController();
myPicker.Delegate = new myPickerDelegate(this);
myAlbumButton.Clicked += delegate {
if(UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary)){
myPicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
myPicker.AllowsEditing = true;
this.PresentModalViewController (myPicker, true);
}else{
Console.WriteLine("cannot get album");
}
};
myCameraButton.Clicked += delegate {
if(UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)){
myPicker.SourceType = UIImagePickerControllerSourceType.Camera;
//myPicker.AllowsEditing = true;
this.PresentModalViewController (myPicker, true);
}else{
Console.WriteLine("cannot get camera");
}
};
}
private class myPickerDelegate : UIImagePickerControllerDelegate
{
private TestView _vc;
public myPickerDelegate (TestView controller):base()
{
_vc = controller;
}
public override void FinishedPickingImage (UIImagePickerController myPicker, UIImage image, NSDictionary editingInfo)
{
// TODO: Implement - see: http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
_vc.myImageView.Image = image;
myPicker.DismissModalViewControllerAnimated(true);
}
}
Le code semble raisonnable pour moi .... si vous franchissez, où ça plante? – NeilDurant
je voudrais également vérifier tweetstation - miguel (si je me souviens bien) utilise une classe de caméra singleton - peut-être copier son modèle? – iwayneo
J'ai le même problème. Avez-vous une solution pour cela? –