soffes / SAMTextView

Add a placeholder to UITextView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xcode6 and iOS8 crash due UIViewControllerHierarchyInconsistency

jomnius opened this issue · comments

Using SAMTextView component via storyboard, Xcode5 was ok. When compiled with Xcode6 and run under iOS8, app crashes:

*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:UICompatibilityInputViewController: 0x18b58560 should have parent view controller:MyViewController: 0x178d5620 but requested parent is:UIInputWindowController: 0x169fc600'

Haven't found a fix yet, stack overflow seemed to suggest removing component from superview and/or not using storyboard at all. Still researching, but hoping "you" (anyone) could suggest a fix right away.

Bumb. Any ideas, anyone? Xcode6 deadline closing in fast...

Well since the error is related to view controllers, I doubt text view is related. Can you provide a sample project reproducing this?

Sam

On Thu, Dec 4, 2014 at 5:52 AM, Jouni Miettunen notifications@github.com
wrote:

Bumb. Any ideas, anyone? Xcode6 deadline closing in fast...

Reply to this email directly or view it on GitHub:
#25 (comment)

Did some more debugging, as I should have in the beginning: crash even with basic UITextView in storyboard, so not connected to SAMTextView. There's something very strange in this project I've inherited.

As it is, case can be closed. Sorry for the trouble!

Found the problem: storyboard contained a toolbar that was set to textView.inputAccessoryView in code. Worked ok with Xcode5, but crashes with Xcode6. Problem has nothing to do with SAMTextView, therefore this case can be closed. Sorry for the trouble!

Well, one more time with the fix: I still create toolbar in storyBoard (I'm visual person, things are easier when I see them), but I "reset" the parentViewController with a call to removeFromSuperview. Seems to work.

@property (weak, nonatomic) IBOutlet UIToolbar *keyboardToolbar;
[self.keyboardToolbar removeFromSuperview];
self.feedbackText.inputAccessoryView = self.keyboardToolbar;