I am getting constant and seemingly random crashes in my NotificationService app extension. This is my first app extension so I'm not sure how debugging normally works, but my exceptions breakpoint is not getting triggered. The extension just exits and the default notification goes through. I've been able to track down specific spots where the extension crashes using line breakpoints and simply stepping through until it crashes. The odd thing is that it will consistently crash on the same exact line every time (so it doesn't seem to be a memory pressure issue). I can't find any ryhm or reason behind any of this. Here are a few examples of crashes:
for key in dict.keys {}
but notfor (key, _) in dict {}
.dateFormatter.date(from:)
but not justdateFormatter
.attributes.count
where attributes is a custom struct.existingObjects.insert(newObject, at: 0)
but notexistingObjects.append(newObject)
I haven't seen the crash on my iPhone 6, but my iPad Air 2, iPhone 6s Plus and iPhone 7 all consistently crash on the same line until I make a change, which moves the crash to a new point in the code.