let a = attachment.localPath
DispatchQueue.main.async {
let b = attachment.localPath
}
If I'd print those with the debugger, the value of a is a valid path, while the value of b is nil.
The value for attachment.localPath was edited before this code runs, and all contexts were saved.
This only happens if I build my app on Xcode 10 and run it on iOS 13. If I run it on iOS 12 everything goes well. If I build on Xcode 11 and run on iOS 13, everything's fine as well.
The variable attachment is a managed object, that contains an attachment card (another managed object), that has the attribute localPath. The getter for localPath in the attachment object just returns the value of attachmentCard.localPath.
I've tried the same with another attribute from attachmentCard and it works fine, both a and b get the correct value.
I've placed a breakpoint on the setter for localPath, and nothing sets it to nil.
What could be happening here?