• Follow the previous code, continue to develop, the implementation of the call third party QMUIKit, call from the gallery to select the picture, and then use the proxy callback out, directly on the code

So this last run says self is nil

What’s going on? So in the closure of Swift, which is a very common memory management mechanism, you don’t see self being nil very much, right

And then I suspect it’s a local variable problem

let ac = ZLPhotoPreviewSheet(selectedAssets:[])
Copy the code

This code becomes a global variable, and then it prints out, again self is nil

So the last solution is, don’t do [weak self], so self is going to have a value, not nil and then deinit, that also prints out, no memory problems.