我收到错误说"致命错误:在展开可选值时意外发现nil"在下面的粗体代码行中。我正在使用Xcode 7.2
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
self.dismissViewControllerAnimated(true, completion: nil)
**myImageView.image = image**
}
答案 0 :(得分:0)
您应该在解除视图控制器之前设置图像。
public List<ExistedProducts> GetStock()
{
var result = from p in Products
join st in Stock on st.ProductID equals p.ID
select new{ExistedProductID=p.ID,ExistedProductQte = st.Qte};
return result.Cast<ExistedProducts>.ToList();// exception here
}
答案 1 :(得分:0)
只需添加问号即可避免此问题:
myImageView?.image = image