ios - Is it safe to catch an exception from [NSObject removeObserver:forKeyPath:]? -


i have code uses kvo heavily , have addobserver:forkeypath: , removeobserver:forkeypath: in multiple places. app crash "cannot remove observer key path."

i wondering if safe try/catch exception prevent app crashing. know it's not best approach in handling kvo need buy time before can clean code.

exceptions, internal apple apis, should never silently caught , ignored. in objective-c exception should cause app terminate, unlike other languages , runtimes (java, .net) catching exceptions normal part of development.

if getting crash, have bug somewhere , need fix it. swallowing exception have pretty bad consequences due getting inconsistent state. don't it.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -