Reputation: 337580
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.
Upvotes: 1
Views: 1188
Reputation: 1385
In my case, the view controller was only included in one of the build targets, and the program crashed when the program for the target that did not include the view controller crashed.
Upvotes: 0
Reputation: 8170
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.
Upvotes: 2