EDIT: I just started checking out some other stuff on my app and now these crashes are happening on the iPhone too. That has not been a problem until now. Ugh. Still looking now...
I have a tabbarcontroller and on each viewcontroller in that tabbarcontroller I have a left and right swipe gesture setup to flip the page left or right depending on the user's action. It works great on the iPhone and has for quite a while. I just recently made my app universal and on the iPad it's crashing when the animation completes.
Interestingly, in debug and in the iOS Simulator, the app does not crash. Just on the iPad after an install from testflight.
The key point here is that the animation does actual happen and finishes and then the app crashes. I had this error happening on this particular transition and also on another transition for an image viewing class I have. In that case, the animation to open the image for viewing works fine. But when the close animation happens, it crashes.
Here's my example to transition on right or left swipe. NOTE: The code below contains my work around by checking the UserInterfaceIdiom. Take that line out and the iPad crashes, but iPhone works fine.
protected void HandleLeftSwipe(UISwipeGestureRecognizer recognizer) { if (this.TabBarController.SelectedIndex != 4) { UIView fromView = this.TabBarController.SelectedViewController.View; UIView toView = this.TabBarController.ViewControllers[this.TabBarController.SelectedIndex+1].View; if (UserInterfaceIdiomIsPhone) { //This was my fix to stop the crash, but I want the animation effect to work. UIView.Transition (fromView, toView, .5f, UIViewAnimationOptions.TransitionFlipFromRight, null); } this.TabBarController.SelectedIndex = this.TabBarController.SelectedIndex + 1; } } protected void HandleRightSwipe(UISwipeGestureRecognizer recognizer) { if (this.TabBarController.SelectedIndex != 0) { UIView fromView = this.TabBarController.SelectedViewController.View; UIView toView = this.TabBarController.ViewControllers[this.TabBarController.SelectedIndex-1].View; if (UserInterfaceIdiomIsPhone) { //This was my fix to stop the crash, but I want the animation effect to work. UIView.Transition (fromView, toView, .5f, UIViewAnimationOptions.TransitionFlipFromLeft, null); } this.TabBarController.SelectedIndex = this.TabBarController.SelectedIndex - 1; } }
Bob
Posts
Can you attach a (symbolicated) crash report and add your version information (from Xamarin Studio's about box -> Show Details)?
Rolf,
Here's one I just created this morning. The crash happens when building as adhoc or release but does not happen when built as debug.
Thanks for taking a look,
Bob
Please always include the version of the software you're using along with the iOS version (of the simulator or devices).
The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Here you go. Note: I am using the alpha channel because of your post in this thread, Sebastien. (http://forums.xamarin.com/discussion/9506/ios-5-and-6-simulator-not-working) However, the problem also was happening in the current stable release.
The 7.0.3.213 alpha has an issue with release builds (that includes Adhoc and AppStore). That's fixed in .215+ but it's not yet published.
Note: that problem is not present in the stable 7.0.2 release.
Ok, thanks Sebastien (Again). Good to know it has been addressed.
Bob