UIImagePickerController在50-60张图像后崩溃应用程序

时间:2016-07-01 13:00:11

标签: ios swift memory-leaks uiimagepickercontroller

我在swift中遇到了UIImagePickerController的严重问题。在连续捕获50-60张图像后,应用程序崩溃而没有在结构崩溃中记录任何问题。这似乎是一个记忆问题。 我尝试了以下解决方案。

Meteor.publish('data_public',function(){
  return DATA_DB.find({},{sort: {published_at: 1},limit:10});
})

知道这里有什么问题吗?我们将不胜感激。 感谢

@interface UIImagePickerController (Singleton)
   +(UIImagePickerController *) instance;
@end

@implementation UIImagePickerController (Singleton)
  +(UIImagePickerController *) instance{
   static UIImagePickerController *_instance;
   static dispatch_once_t onceToken;
   dispatch_once(&onceToken,^{
     _instance=[[UIImagePickerController alloc] init];
   });
   return _instance
  }

if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
    let image = UIImagePickerController.instance() //Singleton call used here
    image.delegate = self
    image.sourceType = UIImagePickerControllerSourceType.Camera
    image.allowEditing = true
    self.presentViewController(image,animated: true,completion: nil)
}

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]){
    autoreleasepool{
      var image: UIImage? =info[UIImagePickerControllerOriginalImage] as! UIImage
      imageView.image = Utils.resizeAndCompress(image)
      image=nil
   } 
   self.dismissViewControllerAnimated(true,completion: nil)
}

崩溃解决方案 问题似乎是iOS版本。我使用AVVideoCapture创建了自定义图像选择器控件。现在我能够拍摄超过1000张图像。

0 个答案:

没有答案