Photos framework: Connection to assetsd was interrupted or assetsd died

前端 未结 3 1332
长情又很酷
长情又很酷 2021-02-15 16:48

I am getting this error when I am trying to play multiple videos using this swift library (https://github.com/piemonte/player). Not sure if it\'s related to that player, or to t

3条回答
  •  醉梦人生
    2021-02-15 17:31

    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.

提交回复
热议问题