Swift 线程1:信号SIGABRT始终是连接问题(cgimagedestinationfinalize)
使用此块,我的应用程序每次尝试运行时都会崩溃Swift 线程1:信号SIGABRT始终是连接问题(cgimagedestinationfinalize),swift,cgimage,Swift,Cgimage,使用此块,我的应用程序每次尝试运行时都会崩溃 CGImageDestinationFinalize(gifDest!) 挡块 错误报告 我不知道这次撞车的原因。所有关于“线程1:signal SIGABRT”的研究似乎都认为这是一个连接问题,但如果我对CGImageDestinationFinalize()进行注释,我的整个应用程序都可以正常工作 使用CFMutableData初始值设定项 CFDataCreateMutable(kCFAllocatorDefault, 0) 已解决此问题
CGImageDestinationFinalize(gifDest!)
挡块
错误报告
我不知道这次撞车的原因。所有关于“线程1:signal SIGABRT”的研究似乎都认为这是一个连接问题,但如果我对CGImageDestinationFinalize()进行注释,我的整个应用程序都可以正常工作
使用CFMutableData初始值设定项
CFDataCreateMutable(kCFAllocatorDefault, 0)
已解决此问题。错误消息表示您正在尝试将数据附加到不可变(NSData)对象。通常,将类型转换为可变(核心)基础类型在Swift中不起作用。大多数
信号SIGABRT
错误都是试图打开nil
。请参阅,谢谢。我将立即编辑我的帖子
func createGIF(with images: [CGImage], data: CFMutableData, loopCount: Int, frameDelay: Double) -> Data {
print("()createGIF.HandHistoryTableVC")
let gifDest = CGImageDestinationCreateWithData(data, kUTTypeGIF, images.count, nil)
let fileProperties = [kCGImagePropertyGIFDictionary as String: [kCGImagePropertyGIFLoopCount as String: loopCount]]
CGImageDestinationSetProperties(gifDest!, fileProperties as CFDictionary?)
let frameProperties = [(kCGImagePropertyGIFDictionary as String): [(kCGImagePropertyGIFDelayTime as String): frameDelay]]
for img in images {
CGImageDestinationAddImage(gifDest!, img, frameProperties as CFDictionary?)
}
print("GIF in Progress")
CGImageDestinationFinalize(gifDest!)
print("gifMade")
return data as Data;
}
CFDataCreateMutable(kCFAllocatorDefault, 0)