App crash when hitting back Navigation Controller - ios

I have a strange issue where when I hit back (returning to UIViewController I had pushed from), my app crashes. It seems something is sending a message to my deallocated UIViewController (the one being popped).
I think the message being sent is UIViewHierachy Subviews. I do have code in both VCs that called viewDidLayoutSubviews but commenting this out did not help.
When I add an exception breakpoint, my app crashes when launching! Is this a storyboard issue or something in my code?
Crash log says :
2015-02-05 12:37:26.255 FitSpot[46915:6318736] *** -[TrainerCreateNewAccountViewController isKindOfClass:]: message sent to deallocated instance 0x7f988636ad40

Turns out quickly copying and pasting code was my problem:
self.emailSignUpField.layer.delegate = self;
Forgot to remove the layer portion line

Related

App crashes sporadically when dismissing a presented UIViewController

Over the last few months we are facing the following issue intermittently in the app we are developing.
The App: It's a fairly complex iOS app with a tabbar-based navigation developed in Swift. It has a good number of pushes and presentations.
The issue: We sporadically encounter app crashes when presented view controllers are dismissed. These crashes are not reproducible, and you cannot find a scenario where this will definitely happen. The app does not crash indicating a line in our code. It is observed in various versions of both iOS 8 and iOS 9 devices. We never get any log pertaining to the crash.
As seen in the images, there's not much to go on with. But, on constant observation of crashes over the months, we've noticed something on the Thread 1 in the left bar of the Xcode window. The stack leading to the crash will always end with [UINavigationController viewWillAppear:]
Also, as seen in the stack is a line indicating '_CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER...' which made us suspect that an NSNotification selector is being called on a deallocated class. For this, we made sure that we removed all NSNotification observers in all classes before deallocations and also had logs in deinit methods of every class and made sure they were deallocating when required. This still didn't solve the problem.
Can somebody please help us with this issue?
Are you using a delegate pattern? If you are, then the delegate properties should always be declared as weak. I am guessing you have a strong reference to a delegate property somewhere and a controller that uses notifications isn't getting deallocated.

Application Crashes When Dismissing Modal View Controller

There's somewhere in my app that I dismiss ModalViewController and it causes app to crash with the following log :
-[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:]: message sent to deallocated instance 0x5c92640
Can anybody help me finding what the problem is please ?
Any suggestion's really appreciated.
P.S: Here's the full scenario : My app presents a Modal View Controller when it receives some kind of notifications ( Incoming call request ), and if the call is being ended before user accept or reject the call, the view controller is being dismissed automatically. However this is what happens in foreground. When the app is in background, if the call end before user enter the app, that "Automatically dismissing view controller" causes this crash.

UINavigationController crashes when targeting iOS7 SDK

I have a UINavigationController, that I use to transition between an 'Inbox' and 'Outbox' view controller.
It works fine in iOS6, but when I target iOS7, I get the following:
-[_UINavigationBarBackIndicatorView setAlpha:]: message sent to deallocated instance 0xc383c90
This happens when I call
[rootNav pushViewController:outbox animated:NO];
I've enabled Zombies and used the Allocate instrument to get some more information.
I've attached a screenshot of what I found.
Unfortunately, I have no idea what to do with this information. Does anyone have any ideas?
Also, this app does not use a back button. Maybe this is the issue?
Thanks!

An object is being double deallocated unintentionally?

I have a tab bar application where in one tab bar, there are 7 separate UISwitch instances. When I run the application and go to the tab bar with the switches, I then call
[self dismissModalViewControllerAnimated:YES completion:nil];
Then I call
[self presentModalViewController:myController animated:YES completion:nil];
When I return to the same tab bar with the 7 UISwitches and I touch one of them, changing the state, the app crashes. So I enabled NSZombie objects and ran the app again and this time when it crashed, it gave the error message
[UICGColor retain]: message sent to deallocated instance 0x9ace8a0
This means that the object was double deallocated, and I obviously didn't try doing this. So, I did some research and found that I could find the line(s) of code that cause it to double deallocate by profiling the app with an NSZombie template, using the Xcode built-in instruments. I then intentionally caused the app to crash, and the I received this.
I can clearly see that my ChessTimer library is releasing the object one too many times, causing it to double deallocate. So, I next looked at the exact line(s) of code that are doing this and found this
I can see the lines of code now that are directly causing the problem. When I remove them, the app runs fine. The problem, however, is that these lines of code are an important design element in my app that I must keep. I don't even know why these lines of code are causing the app to deallocate that object again. How can I either neutralize this deallocation or find another workaround? All help is appreciated.

UINavigationBar back button crashing the app?

When I run my app in simulator everything is fine, but when I run in device it is crashing.
Reason is I am pushing one xib from my storyboard and it's working well but when I press the back button it is crashing and [myxib class name method] message sent to deallocated instance 0x1fc65600. But in simulator it's fine, is that due to memory leak?
It is pointing to:
0x311ad468 trap <--- Thread1:EXC_BREAKPOINT (code =EXC_ARM_BREAKPOINT ,subcode=0xdefe))
[self.navigationcontroller pushviewcontroller:obj animated:YES];
I solved it,first thing is iam retrieving some values in previous class from someother class,so when iam out of focus that value transaction is throwing exception,so what i done is i disable the back button for some seconds

Resources