UIActivityViewController crash on iPad landscapoe only app - ipad

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!

Related

How to present iOS Keyboard extension using presentViewController

My goal is to present the iOS Keyboard with the method presentViewController:animated:completion whenever the keyboard has successfully instantiated, taking advantage of the smooth upward animation.
Some very brief background: the keyboard extension project is written in Objective-C, with KeyboardViewController.h/.m handling the logic and some basic view layout from a inputView.xib.
Based on this SO question, several of the the answers suggested using the approach of calling presentViewController from [UIApplication sharedApplication].keyWindow.rootViewController. The problem is, as this is an iOS extension, when I try to replicate this method, I get the error that sharedApplication is not available. I was wondering if a workaround exists where I could present the Keyboard with the method presentViewController, either somehow via itself or via a super? In my current attempts, calling [self presentViewController: self...] causes an exception.
Much appreciated!
It can't be done.
One can actually acquire a reference to [UIApplication sharedApplication] easily, the most straightforward (though liable to get you rejected in App Store review) would be:
Class appClass = NSClassFromString(#"UIApplication");
id app = [appClass performSelector:#selector(sharedApplication)];
Running on the iPhone 5 simulator, [app keyWindow] returns nil when called from the principal input view controller's viewDidAppear: method.
[UIApplication windows], however, does not, so we could try
[[[app windows].firstObject rootViewController] presentViewController:self
animated:YES
completion:nil];
...but it just throws an exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present
modally an active controller .'
Walking the view hierarchy starting from UIApplication windows] reveals an interesting fact: the window of our UIInputViewController isn't in this window hierarchy. self.view.window returns a separate _UIHostedWindow with no superView.
Furthermore, There is no variation across apps of the addresses in memory of windows returned from [UIApplication sharedApplication].
Conclusion: the UIApplication we get from sharedApplication is the one for our process, not for the host process. Presenting on views and windows it owns therefore is pointless, because its views aren't visible to the user.

Crashing app when cancelling taking picture within the camera is processing the image shot

There is a scenario, when I try to take a picture on a device and I press the "shutter" button and right after that I press cancel (dismiss) – as a result, I get error that I can't track. It says:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: UIImagePickerControllerOriginalImage)'
*** First throw call stack:
(0x18271c2d8 0x193f400e4 0x182605428 0x18df304e8 0x18df30188 0x18df7d728 0x18df7dd28 0x188ef111c 0x188ef08a4 0x100f80fd4 0x100f80f94 0x100f85c28 0x1826d37f8 0x1826d18a0 0x1825fd2d4 0x18be136fc 0x1871c2fac 0x1002c35c0 0x1945bea08)
More information about the context:
I have iPhone 6 running iOS 8.3
I'm using the UIImagePickerController it crashes before calling the "imagePickerController: didFinishPickingMediaWithInfo:" method.
I have custom overlay with cancel button, which calls method to dismiss the UIImagePickerController.
Is this a common bug of the iOS or do I have something wrong?
Could it be because I use custom overlay with the custom cancel button?

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
}

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)

setRefreshed: unrecognized selector sent to UIViewController in Landscape Mode

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.

Resources