我的应用程序正在获取CoreData字符串和uiimages。我还拍摄了相机的实时馈送,并将其显示在UIView上。随机装置‘失去连接’。我检查了内存和CPU的使用情况,似乎没有出什么问题。

我偶尔会收到这些打印警告
收到了内存警告。 _BSMachError:(os/kern)无效名称(20) _BSMachError:(os/kern)无效名称(15) 通信错误:{ count = 1,contents = "XPCErrorDescription“=> { length = 22,contents = "Connection interrupted”} }>
我已经尝试将Info.plist中的本地化本地开发区域设置为美国,这是广泛建议的,但不是运气。
我在我的测试设备(iPod)上运行Xcode 9 BETA和iPod 10。
发布于 2017-09-10 18:39:11
我的拍摄方式返回了一个非常高质量的图像(1000像素)。因此,当我在prepareForSegue中传递图像并使用Core保存它时,它正在重载设备。
所以我用这段代码来缩小图像的大小,这就奏效了。
func resizeImage(image: UIImage, newWidth: CGFloat) -> UIImage {
let scale = newWidth / image.size.width
let newHeight = image.size.height * scale
UIGraphicsBeginImageContext(CGSize(width: newWidth, height: newHeight))
image.draw(in: CGRect(x: 0,y: 0,width: newWidth,height: newHeight))
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage!
}https://stackoverflow.com/questions/46003294
复制相似问题