setRefreshed: unrecognized selector sent to UIViewController in Landscape Mode - ios

I have multiple UITableviewControllers which support landscape mode and one UIViewController which does not support landscape mode. Regardless of which view is showing, when I close the app while in landscape mode I get the following exception:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LedgerViewController setRefreshed:]: unrecognized selector sent to instance 0x161df0'
Closing the app in portrait mode does not generate the exception.
A full search of my project does not find the term "setRefreshed" nor can I find the term in any Apple documentation or via Google.
Any ideas?

I found the problem thanks to the AWESOME people at raywenderlich.com who take the time to write some of the best tutorials available: My App Crashed, Now What? – Part 1
An exception breakpoint led me to some poor code in my ApplicationDelegate which assumed the navingationController's rootViewController was "RootViewController" which has a BOOL property of "refreshed". That was a good assumption until I implemented a different view for landscape mode. Hence the reason why the exception was only thrown in landscape mode.
Things I learned today:
With KVC, it should have been obvious to me that "setRefreshed" is the KVC equivalent to "????.refreshed".
I should have read up on advanced debugging techniques years ago.

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.

UIActivityViewController crash on iPad landscapoe only app

I just added an UIActivityViewController to share some App data to Facebook, Twitter or email.
The popoverPresentationController is displayed and the listed activities can be selected and the content is shared without problems.
Crash happens when you tap on More... and then hit the done button in the presented empty activities list.
The activities are presented by:
controller.popoverPresentationController.sourceView = cell;
[[CliqmusicViewController instance] presentViewController:controller animated:YES completion:nil];
When the Done button is tapped i got the following exception:
* Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [_UIUserDefaultsActivityNavigationController shouldAutorotate] is returning YES'
The _UIUserDefaultsActivityNavigationController seems to be an SDK internal class, so there is no way to subclass or build a (category) for it.
Using 8.4 SDK.
Any thought? Thanks!

Error in iOS7. view controller won't show

Having a strange problem that is getting me into a bit of a panic. Just tested my app on iOS7, when I try to present one of my view controller via segue. I get the error message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '`**Application tried to present a nil modal view controller on target <SendMessageViewController: 0x15524320>.'**`
Have no idea why this is happening. It works fine in iOS8 but could someone give me some pointers to what I might be doing wrong please?
First of all check the identifier of the viewcontroller is same that you mentioned in storyboard.
Than set back point on this exception to see if model is not nill.
UIAlertController is not supported by iOS 7 so in you're situation you should check the version of the iOS device and that use particular logic.
Use condition to detect if it is possible to use UIAlertController
if NSClassFromString("UIAlertController") != nil {
// Use it
} else {
// Fall back
}

[UIView context]: unrecognized selector sent to instance after upgrade to Cocos2D-Swift v3.4.3

After upgrading an existing stable IOS app with the new version of the cocos2d library the app started crashing with the [UIView context]: unrecognized selector sent to instance error.
This typically occurs after CCDirector purgeCachedData is called. Even after doing several things to reduce the memory resources used to almost half that being used by the app under the old cocos2d x3.0.0 alpha version.
The base of the app is using UIKit with cocos2d animation over the top of 4 different view controllers / uiviews.
Thanks in advance for any suggestions!

Phone gap app crashes by tapping on select box on iOS 8

I have created a phone gap app having two select boxes for date control and time control. On tapping more than once on any of these select boxes causes the app to crash. It gives the following error:
Error 1.** WebKit discarded an uncaught exception in the webView:willRemoveScrollingLayer:withContentsLayer:forNode: delegate: -[WebActionDisablingCALayerDelegate setBeingRemoved:]: unrecognized selector sent to instance 0x78f35320
Error 2. Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController () should have a non-nil sourceView or barButtonItem set before the presentation occurs.
I have read an answer (UIActivityViewController crashing on iOS8 iPads) to solve this by native approach. Can anyone let me know how to fix it in the hybrid app.
Thanks
in my case (phonegap app with OnsenUI Framework) I faced the same problem and I figured out it happens due to -webkit-overflow-scrolling: touch; on multiple elements inside a wrapper. After removing the error was gone (at least in my case)

Resources