0

I have two view controllers that both return to the home VC using

[self dismissModalViewControllerAnimated:NO];

One of them works and triggers it using a storyboard created button, whilst the one that doesn't work triggers it using a programmatically created button.

When the button on the second one is pressed it does move to the home VC, but instantly crashes

Update:

New Output

** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_questioner_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTYxYWQ0YjBlMTY1MGIwZjZlMDA5NDkxNmI2MzQxZmFhBjsAVA%3D%3D--15054ec7f94935cfc07bad559f1d52cd65ea5e4b: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: scoringData Observed object:

It seems to crash when it gets to this point

+(void)processScoringData:(NSMutableData*)response { [DataStore dataStore].scoringData = [[NSMutableDictionary alloc]init];

After adding an exception break point I get this beside the output. Not sure if it helps?

ServerInterface
(Class) [0] = <error: unknown Class>

response = (NS MutableData*)
NSData  NSData  
NSObject    NSObject    
isa Class   0x3c35b9ac
[0] Class   <error: unknown Class>
0x8badf00d
  • 6,391
  • 3
  • 35
  • 68
  • a good explanation at http://stackoverflow.com/questions/12445190/dismissmodalviewcontrolleranimated-deprecated – Piyuesh Jul 04 '13 at 11:26
  • 1
    Has nothing to do with deprecation of `dismissModalViewController:` in iOS6. `scoringData` is being observed by some Object and it got changed. KVO reported that change to Observing object. It might be that the Object which was observing scoringData got deallocated. Update your question with backtrace information. i.e., when your application receives this uncaught exception in debugger use bt command (lldb)bt – 0x8badf00d Jul 04 '13 at 12:28
  • Okay, I am trying to find out how to do that now – AnotherNewbie Jul 04 '13 at 13:09
  • I couldn't find an explanation. I added an Exception Breakpoint however. – AnotherNewbie Jul 04 '13 at 13:48
  • Search in your code where you are observing for change in `scoringData`. For example - `[someObj addObserver:self forKeyPath:@"scoringData" options:NSKeyValueObservingOptionOld context:NULL];` and did you implement `observeValueForKeyPath:ofObject:change:context:` – 0x8badf00d Jul 04 '13 at 17:34
  • Yes, it's definitely causing a problem at this line. `code[[DataStore dataStore] addObserver: self forKeyPath:@"scoringData" options:NSKeyValueObservingOptionOld context:nil]; ` If I comment it out it works. I'm not even sure if I need it because I can't see that anything stops working when it's out. I have the other one implemented as `code-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@"scoringData"]) { // [self resetWheel]; } }` – AnotherNewbie Jul 05 '13 at 08:56

1 Answers1

-1

[self dismissViewControllerAnimated:NO completion:nil]; use instead of your dismiss controller method because your method is deprecated.

Definitely work for You.
Dipak Narigara
  • 1,796
  • 16
  • 18
  • It has been deprecated in iOS 6, so in future apple might get rid of `dismissModalViewControllerAnimated:`. In the event it happens, Application would crash with unrecognized selector sent to instance exception. – 0x8badf00d Jul 04 '13 at 12:34
  • Changing it to that had no effect. – AnotherNewbie Jul 04 '13 at 13:32