On 20 août 2015, at 03:25, Justin Kolb <frantica...@gmail.com> wrote:The error you provided definitely points to Swift internal functions that are called when unowned references are used. There have been reported cases of unowned being buggy in older versions of Swift. I usually debug these kind of issues by putting a breakpoint in the deinit method of the object I think is getting dealloced. But if this is a compiler bug there might not be much you can do. I would still strongly suggest against using unowned in most code, especially if multiple threads are involved.On Aug 19, 2015, at 7:10 PM, Jean Suisse <jean....@gmail.com> wrote:
In my case, self refers to the AppDelegate instance. It should live as long as the app is running, so I shouldn’t get this crash.
How can I investigate this?
On 20 août 2015, at 02:03, Justin Kolb <frantica...@gmail.com> wrote:
From my experience this is due to usage of unowned self. You have to be 200% sure your block will outlive self or you will get this crash. It is usually better to use weak self in you blocks and then do "if let strongSelf = self {" and do your work inside this if statement using strongSelf instead of self. This guarantees that if you are inside the "if" the self will be kept alive by the strong reference. This tip applies to Objective-C also.
--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swift-languag...@googlegroups.com.
To post to this group, send email to swift-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/45f6ecdc-8d6f-4158-a913-fa306075ed8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/F530C405-1F56-4063-BD13-0B3109CE7539%40gmail.com.