0

Installed Xcode 7.1 Beta and tested my app on iOS 9.0 and got below error. I went thorough different questions here.

I am using IIViewDeckController for left menu and PullRefreshTableViewController. In app delegate I register to different notification and give webservice call to get data for view controllers of VC1(Menu1) and VC2(Menu2), both inherits PullRefreshTableViewController. VC1 is displayed at first. When user navigates to VC2 the view gets loaded with data pulled but crashes with below exception.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fa8c541eaf0 of class UIView was deallocated while key value observers were still registered with it. Current observation info: ( Context: 0x0, Property: 0x7fa8c1d1b470> )'

*** First throw call stack: (

0   CoreFoundation                      0x0000000110d7df65 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x00000001107f5deb objc_exception_throw + 48
2   CoreFoundation                      0x0000000110d7de9d +[NSException raise:format:] + 205
3   Foundation                          0x000000010f6528c1 NSKVODeallocate + 294
4   libobjc.A.dylib                     0x000000011080a0b8 _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 488
5   CoreFoundation                      0x0000000110c6b956 _CFAutoreleasePoolPop + 22
6   CoreFoundation                      0x0000000110c9f8d1 __CFRunLoopRun + 2081
7   CoreFoundation                      0x0000000110c9ee28 CFRunLoopRunSpecific + 488
8   GraphicsServices                    0x00000001134e4ad2 GSEventRunModal + 161
9   UIKit                               0x000000010e12eca1 UIApplicationMain + 171
10  SeeMyRadiology                      0x000000010d0d507e SeeMyRadiology + 16510
11  libdyld.dylib                       0x000000011126992d start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

**NOTE:**Same code works on iPad without error

3
  • Did you registered any KVO in that class and did you remove those before the object gets deallocated ?
    – Midhun MP
    Sep 22, 2015 at 7:17
  • Nope. I have not registered any KVO.
    – Sumit
    Sep 22, 2015 at 11:02
  • iOS 9.1 same code works for iPad but not for iPhone.
    – Sumit
    Sep 22, 2015 at 11:33

3 Answers 3

0
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
    UIViewController* menuController = [mainStoryboard instantiateViewControllerWithIdentifier:@"LeftSideMenu"];

    UINavigationController* navigationController = (UINavigationController *) self.window.rootViewController;
    self.viewDeckController =  [[IIViewDeckController alloc] initWithCenterViewController:navigationController leftViewController:menuController rightViewController:nil];
    self.window.rootViewController = self.viewDeckController;
}

OR https://github.com/edgecase/ECSlidingViewController

Just in case unable to solve problem.

1
  • I am not using StoryBoard :( . But the root controllers is similarly set.
    – Sumit
    Sep 22, 2015 at 11:04
0

If your table is reloaded it's possible that you loose your views, I mean, they are deallocated. If there are some connections beetwen deallocated views and values somewhere it causes the crash. You need to stop observing values before deallocating in order to avoid crash. Check this scenerio.

0

This worked for me. The problem was while pushing view over the IIViewDeckController.

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

UINavigationController *centerController = [[UINavigationController alloc] initWithRootViewController:appDelegate.viewController];
[appDelegate.viewDeckController closeLeftViewBouncing:^(IIViewDeckController *controller)
 {
     appDelegate.viewDeckController.centerController = centerController;
 }];

Thank you your input guys. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.