addObserver_forKeyPath_options_options

An instance 0x18a02a00 of class WCNewCommitViewController was deallocated while key value observers were still registered with it.

Posted by kunnan on September 7, 2018

removeObserver

  • q

    Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x18a02a00 of class WCNewCommitViewController was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x1a59baa0> ( <NSKeyValueObservance 0x19047eb0: Observer: 0x18a02a00, Key path: navigationItem.leftBarButtonItem, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x191df760> )'
    
  • a

            [WCNewCommit removeObserver:WCNewCommit forKeyPath:@"navigationItem.leftBarButtonItem" context:nil];//  Options <New: YES, Old: NO, Prior: NO>   Context: 0x0, Property: 0x180bb480> , Property: 0x19fe2e20>
      
            [WCNewCommit removeObserver:WCNewCommit forKeyPath:@"navigationItem.rightBarButtonItem" context:nil];//  Options <New: YES, Old: NO, Prior: NO>   Context: 0x0, Property: 0x180bb480> , Property: 0x19fe2e20>
      
    

    image

See Also

/Users/devzkn/bin//knpost addObserver_forKeyPath_options_options Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x18a02a00 of class WCNewCommitViewController was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x1a59baa0> ( <NSKeyValueObservance 0x19047eb0: Observer: 0x18a02a00, Key path: navigationItem.leftBarButtonItem, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x191df760> )' -t objc
#原来""的参数,需要自己加上""

转载请注明: > addObserver_forKeyPath_options_options