UINavigationBar back button crashing the app? - ios

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

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.

App crash when hitting back Navigation Controller

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

SKStoreProductViewController not working on iPad iOS 8

I'm using SKStoreProductViewController on iPad with iOS 8. Pressing a button opens an instance of it:
[self.storeProductViewController loadProductWithParameters:#{SKStoreProductParameterITunesItemIdentifier:appStoreIdNumber}
completionBlock:^(BOOL result, NSError *error) {...}];
[[self getPresentingViewController] presentViewController:self.storeProductViewController animated:YES completion:^{...}];
It pops up the first time fine. But after it is dismissed, pressing the button again to reopen it throws an exception and the pop up never appears.
<SKRemoteProductViewController: 0x15c1ec00> timed out waiting for fence barrier from com.apple.ios.StoreKitUIService
Anyone know what's going on or how to work around it?
I've also had some other problems with UIAppearance and StoreKit not working together (see StoreKit's SKStoreProductViewController leaving space between the nav bar and the view?)
I was having the same problem that you now have and removing all UIAppearance code fixed it, but I noticed that the SKStoreProductViewController won't load any iPad apps on an iPhone on iOS 8 and it will fail silently. Let me know if you have the same problem.
I had the same problem, where the first time I present the SKRemoteProductViewController it works fine, but subsequent presentations give the error as the OP described. Apparently the problem is related to presenting the same SKRemoteProductViewController more than once. If I dispose of the SKRemoteProductViewController after presenting it and then re-load another one each time I want it to present again then things work without issue.
Had this problem as well. Make sure that identifier is actually an NSString
#{ SKStoreProductParameterITunesItemIdentifier : identifier }
I was inadvertently passing an NSURL object, which resulted in the same error -- "timed out waiting for fence barrier from com.apple.ios.StoreKitUIService"
you should present SKStoreProductViewController before loading it

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.

Resources