Photos framework: Connection to assetsd was interrupted or assetsd died

前端 未结 3 1340
长情又很酷
长情又很酷 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.

    0 讨论(0)
  • 2021-02-15 17:48

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

    0 讨论(0)
  • 2021-02-15 17:55

    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

    0 讨论(0)
提交回复
热议问题