Photos framework: Connection to assetsd was interrupted or assetsd died

心不动则不痛 提交于 2019-12-03 12:55:28

I had this same "Connection to assetsd was interrupted or assetsd died" error.

Usually followed by a memory warning. I tried to find retain cycles, but it wasn't it.

The problem for me had to do with the known fact that the resultHandler block of any PHImageManager request...() is not called on the main queue.

So we cannot run UIView code directly within those blocks without asking for trouble later on in the app life.

To fix this we may for instance run all UIView code that would be executed within the scope of the resultHandler block inside a dispatch_async(dispatch_get_main_queue(), block)

I was having this problem because I did not realize that one of the functions that I was calling within one of the resultHandler.s of my app did eventually call some UIView code down the line. And so I was not forwarding that call to the main thread.

Hope this helps.

The issue is occurring because of the TargetSize only. The PHImageManagerMaximumSize option is the culprit. Set the CGSIZE as you want for the imageview.

Your problem might be that you create a new Player-object everytime you start playing a video:

 self.currentlyPlaying = Player()

I would recommend you to either remove it after the file has finished playing or to create one player which you will reuse. Otherwise it will stay in the memory.v

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!