Ios 在UICollectionView中滚动时应用程序崩溃
我有一个Ios 在UICollectionView中滚动时应用程序崩溃,ios,iphone,swift,uicollectionview,Ios,Iphone,Swift,Uicollectionview,我有一个UICollectionViewController,其中加载了文档目录中的图像。在模拟器(iPhone6sPlus)上,我似乎没有遇到任何问题,但在iPhone5设备上,当图像数量增加,我不得不滚动时,应用程序就会崩溃。这是我的密码: 在cellForItemAtIndexPath中: let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forInde
UICollectionViewController
,其中加载了文档目录中的图像。在模拟器(iPhone6sPlus)上,我似乎没有遇到任何问题,但在iPhone5设备上,当图像数量增加,我不得不滚动时,应用程序就会崩溃。这是我的密码:
在cellForItemAtIndexPath中:
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier,
forIndexPath: indexPath) as! MyCollectionViewCell
cell.layer.shouldRasterize = true
cell.layer.rasterizationScale = UIScreen.mainScreen().scale
if directoryUrls.count > 0
{
var image = UIImage (named: "pending.png")
let ImgPath = self.documentsPath.URLByAppendingPathComponent("\(String(NSLocalizedString("attachments_folder", comment: "")))/\(self.Attachments[indexPath.row].Name)")
var mimeType = ""
if (self.fileManager.fileExistsAtPath(ImgPath.path!))
{
mimeType = mimeTypeForPath(ImgPath.path!)
}
if (!mimeType.isEmpty)
{
if(mimeType.containsString("image"))
{
Nuke.taskWithURL(ImgPath)
{
self.MimArray.append("image")
self.ImageAttachmentsOnly[self.i] = self.Attachments[indexPath.row]
self.i++
cell.Image.image = $0.image
self.Images.append($0.image!)
}.resume()
}
}
cell.ImageLabel.text = self.Attachments[indexPath.row].Name
cell.Image.contentMode = .ScaleAspectFit
}
return cell
CollectionViewCell中的图像大小为70*70(如果相关)
如果你想让我提供更多的代码,我会的
这就是我从日志中得到的全部信息:
Communications error: <OS_xpc_error: <error: 0x38504654> { count = 1, contents =
"XPCErrorDescription" => <string: 0x38504854> { length = 22, contents = "Connection interrupted" }
}>
Terminating since there is no system app.
通信错误:{length=22,contents=“连接中断”}
}>
正在终止,因为没有系统应用程序。
我刚刚注意到应用程序正在崩溃,手机正在快速重启……您是否有内存问题?您可以在xCode和Instruments中检查这一点。没有内存问题。刚刚检查过