-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashes when modalView is closed from delegate #21
Comments
Can you provide instructions on how to reproduce? |
I added a navigationcontroller with uiviewcontroller as root view controller subclassed with your sample code as MessageComposeViewController. setup a modal seque from a presentingViewController to my messageComposeViewController. when i hit compose in my presentingViewController i perform the modal seque and set itself as the delegate for messageViewController so the topleft navbaritem on my MessageComposeViewController is "cancel" and the top right is "send" all im doing in the send method is capturing the MessageComposeViewController messageView.text and an array of tokens added. then i dissmiss the MessageComposeViewController which causes the crash under the following circumstance: More than one token has been added && messageView.text.length > 1 If i only add one token it does not crash, but more than one token.. crash. Hope this helps. |
Any chance you could create a sample project? I do the same thing in one of my own apps with no problem. |
I'm running into this same problem, or at least a similar one. What seems to have fixed it for me was in the completion block to check complete and only -sendActions if complete, e.g.:
which seems to make sense, but could potentially have side-effects, but probably safe in this case given the limited scope of the animation. Nevertheless, there's something deeper at play. If I can come up with a simple repro I will. |
Great, I'll try a push those changes out soon. |
Well... I'm not 100% sure it is a RIGHT fix, just that it works and does APPEAR to make sense. It'd still be nice to know why the real behavior is happening, but my guess is it's all timing. What seems to happen, at least in my case, is I have added a couple tags, seems to be related to the fact that the tags are long and it causes the tokenfield to adjust its height to be taller to show all the tags. Tap "Cancel" to dismiss my modal view, -dismissModalViewControllerAnimated: is invoked, which for some reason calses -[TITokenFieldView becomeFirstResponder] to be invoked... not sure why, could be because I also have a UISearchBar also in the same view, it was the first responder when Cancel was tapped, and maybe as it's being destructed the responder switches to the TITokenField? I don't know, but that might be the crux of the problem. Anyways, that cascades down like this:
But I end up inside of -layoutTokensAnimated: a few times as things snake through. A couple times because -addToken: was invoked.... and then the animation block itself calls -setFrame: which itself can invoke -layoutTokensAnimated:.... but then it seems the "final" invocation is because a -performSelector happens that ultimately does invoke -[TITokenField didEndEditing] which hits the -layoutTokensAnimated:. And then at that point somewhere in there the -dealloc of the field happens... but the animation completion is still out there, and boom. Like I said... I do have that UISearchBar also in there (that and the TITokenField are the only textually editable views in my modal view). If the TITokenField is the current responder when I dismiss the modal view, no crash. It requires the UISearchBar to be the responder. AND it doesn't seem to matter how many tokens are in the field, just that it's enough tokens (when they draw with the token rect cosmetics) that it would cause the field to grow to be more than 1 line tall. So.... hopefully that information may be of use to find the real problem. To @travisjbeck , does any of this perhaps ring a similar bell for you? |
Thanks so much for all this, I'm super swamped at the moment so I'll try to dig a little deeper ASAP. |
You're welcome. If I can help any further, please let me know. |
The same method crashes for me if i minimise my app and then the completion block fires and gets EXC_BAD_ACCESS |
I am having same issue. But checking complete flag didn't solved my problem Is there any other solution? |
The text was updated successfully, but these errors were encountered: