1

I have a UICollectionView am displaying images and gif files in Custom Collection cell. when I scroll the collection view the app crashed with this error log

viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}

Note : It works fine when there is no gif files

and my code is

if indexPath.item == 0{
            DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async {
            let testGifImage = UIImage.gifImageWithName("gifname")

            DispatchQueue.main.sync {
                cell.EmojiImage.image = testGifImage
            }

        }
return cell
    }
    else{
cell.imageView.image = UIImage(named: "imagename\(indexPath.item).jpg")
    return cell
    }
Ragul
  • 3,176
  • 3
  • 16
  • 32
  • http://stackoverflow.com/questions/25895634/email-composure-ios-8 – Anbu.Karthik Sep 28 '16 at 05:32
  • @Anbu.Karthik It happens in real device not in simulator and am using this in Keyboard Extension – Ragul Sep 28 '16 at 05:35
  • Are you sure that `UIImage.gifImageWithName("gifname")` is safe to call on background thread? You can test it by moving it to main thread and checking if the problem has gone. – slashdot Sep 28 '16 at 07:50
  • @slashdot I have tried but no use – Ragul Sep 28 '16 at 08:38
  • Am I right that a problem is in `cell.EmojiImage.image = testGifImage` and will go away if we comment this line? By the way, why you do `DispatchQueue.main.sync` instead of `DispatchQueue.main.async`? Have you tried `DispatchQueue.main.async`? – slashdot Sep 28 '16 at 08:52
  • @slashdot yes but no use. Actually it works fine for small size gifs it makes prob only for large scale gifs – Ragul Sep 28 '16 at 09:01

0 Answers0