Issue
I am attempting to set some properties of my ViewController via the User Defined Runtime Attributes section in XCode and running in to a few issues.
Firstly when the ViewController is instantiated (by a segue in my storyboard) I get the following in the output window:
Unknown class FlyoutViewController in Interface Builder file.
Secondly, I get the following error:
Objective-C exception thrown. Name: NSUnknownKeyException Reason: [UIViewController 0x7fdc1450> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key topViewControllerStoryboardId.
I have read the troubleshooting guide and nothing helped. The only part that stood out for me was:
the types containing the above code must be a subclass of NSObject
Although I fail to see how that is possible when subclassing UIViewController?
For reference here is the relevant parts of my code:
[Register("FlyoutViewController")]
public partial class FlyoutViewController : UIViewController, IUIViewControllerContextTransitioning, IUIViewControllerTransitionCoordinator, IUIViewControllerTransitionCoordinatorContext
{
public FlyoutViewController(IntPtr handle) : base(handle)
{
// Stuff here
}
[Export("topViewControllerStoryboardId:", ArgumentSemantic.Retain)]
public NSString TopViewControllerStoryboardId { get; set; }
[Export("underLeftViewControllerStoryboardId:", ArgumentSemantic.Retain)]
public NSString UnderLeftViewControllerStoryboardId { get; set; }
[Export("underRightViewControllerStoryboardId:", ArgumentSemantic.Retain)]
public NSString UnderRightViewControllerStoryboardId { get; set; }
// More stuff...
}
In the properties of the ViewController in the storyboard I have set the class to FlyoutViewController
and added the following runtime attributes:
topViewControllerStoryboardId | String | FeedNavigationController
underLeftViewControllerStoryboardId | String | MenuViewController
Can anyone tell me where I am going wrong with this?
Thanks in advance.
Solution
The problem is that you are implementing two interfaces that have at least two identical members:
IUIViewControllerTransitionCoordinatorContext
and IUIViewControllerContextTransitioning
.
This is the output I am getting, prior to the "...this class is not key value coding-compliant for the key topViewControllerStoryboardId" message:
Cannot register more than one interface method for the method 'XcodeAttrController.MyController.get_ContainerView' (which is implementing 'MonoTouch.UIKit.IUIViewControllerTransitionCoordinatorContext.get_ContainerView' and 'MonoTouch.UIKit.IUIViewControllerContextTransitioning.get_ContainerView').
Note that my controller here is named "MyController" :).
Implement one of the interfaces in another object and use that one instead.
Answered By - Dimitris Tavlikos
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.