ios - NSUndoManager errors with "unrecognized selector sent to instance" -


working on implementing nsundomanager within ios9 app. current undo code looks this:

func setactivecolordata(colordata: colordata) {     if colordata != activecolordata {         print(self)         undomanager?.registerundowithtarget(self, selector: "setactivecolordata:", object: activecolordata!)         undomanager?.setactionname("change color")         print("set undo action")          activecolordata = colordata     } } 

colordata simple class 3 floats inside of (hue, saturation, brightness) , utility methods.

everything works fine, including shake gesture brings undo prompt. once click undo, app crashes , following error:

2016-02-25 16:26:58.225 color[89399:5503615] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[color.pickerviewcontroller setactivecolordata:]: unrecognized selector sent instance 0x7fa080776820' *** first throw call stack: (     0   corefoundation                      0x0000000105b75e65 __exceptionpreprocess + 165     1   libobjc.a.dylib                     0x0000000108159deb objc_exception_throw + 48     2   corefoundation                      0x0000000105b7e48d -[nsobject(nsobject) doesnotrecognizeselector:] + 205     3   corefoundation                      0x0000000105acb90a ___forwarding___ + 970     4   corefoundation                      0x0000000105acb4b8 _cf_forwarding_prep_0 + 120     5   foundation                          0x00000001066b2feb -[_nsundostack popandinvoke] + 261     6   foundation                          0x00000001066b2162 -[nsundomanager undonestedgroup] + 424     7   uikit                               0x0000000106c46813 -[uiapplication alertview:clickedbuttonatindex:] + 151     8   uikit                               0x0000000106f63589 -[uialertview _preparetodismissfortappedindex:] + 136     9   uikit                               0x0000000106f62fc7 __35-[uialertview _preparealertactions]_block_invoke50 + 53     10  uikit                               0x0000000106f54572 -[uialertcontroller _dismissanimated:triggeringaction:triggeredbypopoverdimmingview:] + 133     11  uikit                               0x0000000107604eb6 -[_uialertcontrollerview _handleactionselectiongesturerecognizer:] + 694     12  uikit                               0x000000010711ee73 _uigesturerecognizersendtargetactions + 153     13  uikit                               0x000000010711b4e5 _uigesturerecognizersendactions + 162     14  uikit                               0x00000001071194e2 -[uigesturerecognizer _updategesturewithevent:buttonevent:] + 843     15  uikit                               0x00000001071219a0 ___uigesturerecognizerupdate_block_invoke904 + 79     16  uikit                               0x000000010712183e _uigesturerecognizerremoveobjectsfromarrayandapplyblocks + 342     17  uikit                               0x000000010710f101 _uigesturerecognizerupdate + 2634     18  uikit                               0x0000000106ca6f8a -[uiwindow _sendgesturesforevent:] + 1137     19  uikit                               0x0000000106ca81c0 -[uiwindow sendevent:] + 849     20  uikit                               0x0000000106c56b66 -[uiapplication sendevent:] + 263     21  uikit                               0x0000000106c30d97 _uiapplicationhandleeventqueue + 6844     22  corefoundation                      0x0000000105aa1a31 __cfrunloop_is_calling_out_to_a_source0_perform_function__ + 17     23  corefoundation                      0x0000000105a9795c __cfrunloopdosources0 + 556     24  corefoundation                      0x0000000105a96e13 __cfrunlooprun + 867     25  corefoundation                      0x0000000105a96828 cfrunlooprunspecific + 488     26  graphicsservices                    0x000000010a416ad2 gseventrunmodal + 161     27  uikit                               0x0000000106c36610 uiapplicationmain + 171     28  color                               0x00000001052a2a7d main + 109     29  libdyld.dylib                       0x0000000108c9992d start + 1     30  ???                                 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating uncaught exception of type nsexception 

i've check pickerviewcontroller instance , memory locations match (from print(self) line, in case 0x7fa080776820). idea why can't invoke selector? or else? thanks!

i'm seeing same kind of crash in photo editing app when memory running low. when memory warning, clear undo manager in case believe crash happens because memory getting deleted out under undo manager.

in case it's related: https://developer.apple.com/library/ios/documentation/cocoa/conceptual/undoarchitecture/articles/cleaningundostack.html


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -