Bug 5317 - Object-C Error on UITabBarController.Transition...
Summary: Object-C Error on UITabBarController.Transition...
Status: RESOLVED FEATURE
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-25 01:45 UTC by steven_licciardi
Modified: 2012-08-10 10:02 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Example monotouch solution with problem (1.33 MB, application/zip)
2012-05-26 00:50 UTC, steven_licciardi
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description steven_licciardi 2012-05-25 01:45:46 UTC
I posted the following on the forum, but got no response, it seems like a bug to me:

I am using the following method call as such:

tabBarController.Transition(fromView, 
				        toView, 
				        0.5,
				        newIndex > _currentIndex ? 
				           UIViewAnimationOptions.TransitionCurlUp : 
                                           UIViewAnimationOptions.TransitionCurlDown, 
				        () => {}, 
					(bool finished) => {});


This results in the error:

MonoTouch.Foundation.MonoTouchException has been thrown

Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: Parent view controller is using legacy containment in 
call to -[UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]


With stack trace:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: Parent view controller is using legacy containment in call to -[UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]
  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_IntPtr_Double_int_IntPtr_IntPtr (intptr,intptr,intptr,intptr,double,int,intptr,intptr)
  at MonoTouch.UIKit.UIViewController.Transition (MonoTouch.UIKit.UIViewController fromViewController, MonoTouch.UIKit.UIViewController toViewController, Double duration, UIViewAnimationOptions options, MonoTouch.Foundation.NSAction animations, MonoTouch.UIKit.UICompletionHandler completionHandler) [0x000b3] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:567
  at CmpMobile.MyTabBarController.<MyTabBarController>m__0 (System.Object sender, MonoTouch.UIKit.UITabBarSelectionEventArgs e) [0x0001e] in /Users/Steven/Projects/CmpMobile/CmpMobile/AppDelegate.cs:89
  at MonoTouch.UIKit.UITabBarController+_UITabBarControllerDelegate.ViewControllerSelected (MonoTouch.UIKit.UITabBarController tabBarController, MonoTouch.UIKit.UIViewController viewController) [0x00012] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UITabBarController.g.cs:344
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
  at CmpMobile.Application.Main (System.String[] args) [0x00000] in /Users/Steven/Projects/CmpMobile/CmpMobile/Main.cs:17
Comment 1 Sebastien Pouliot 2012-05-25 20:19:18 UTC
That message comes from the native side (objective-c). MonoTouch is only relaying this to you. This is likely a restriction that occurs as well in ObjC.

Just to be 100% sure please attach a self-contained sample that shows the issue and we'll investigate this.
Comment 2 steven_licciardi 2012-05-26 00:50:54 UTC
Created attachment 1964 [details]
Example monotouch solution with problem
Comment 3 steven_licciardi 2012-05-26 00:52:12 UTC
OK, example solution in now attached.

Thanks,

Steven
Comment 4 Sebastien Pouliot 2012-08-10 10:02:27 UTC
<quote>This method is only intended to be called by an implementation of a custom container view controller. If you override this method, you must call super in your implementation.</quote>

http://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/transitionFromViewController:toViewController:duration:options:animations:completion:

Your sample does not implement the required code for "Container View Controller" (described in the same link). The same issue would exists in ObjC.

There's a sample that shows how to do transitions available at
https://github.com/xamarin/monotouch-samples/tree/master/ViewTransitions