This class does not meet key requirements (with storyboard)

I'm just starting iOS development with Xamarin and it seems to hit the road block. I am trying to create a custom table cell to display some data. Therefore, taking tips from various online sources (for example, here ), I created a .xib file, deleted the view that Xamarin automatically created, and replaced a UITableViewCell . I added a few shortcuts to my cell, I registered my cell with RegisterNibForCellReuse and set up my class, which inherits from UITableViewSource , to return my custom cell when needed. So far so good.

The problem starts when I take any controls in my user cell and try to create an output. In Xcode, create a power outlet and everything will be fine. Back in Xamarin, I see that it automatically creates a property for it.

 [Register ("MyCustomCell")] partial class MyCustomCell { [Outlet] MonoTouch.UIKit.UILabel MyLabel { get; set; } void ReleaseDesignerOutlets () { if (MyLabel != null) { MyLabel.Dispose (); MyLabel = null; } } } 

But when I try to run the code, I get a runtime error saying This class in not key value coding-compliant for key the key MyOutlet

Any idea what could happen? Xamarin docs suggest a possible reason here , but I'm not sure if this is relevant. I donโ€™t see anything like it in any of the Xamarin designer files, and everything is fine with them. I tried to replace the property definition above with one that uses the Connect attribute instead of Outlet and uses GetNativeField and SetNativeField , but I see the same result.

+4
source share
6 answers

I had this problem for a while, in my case it turned out to be a problem related to the build process. For me this has been fixed:

Right-click your project, select "Options", then "iOS Build" in the subheading "Build", add -f to the "Additional arguments mtouch" and rebuild.

+7
source

I ran into the same problem and finally I did Product-> Clean inside Xcode and solved my problem.

+4
source

Right-click your project, select "Options", then "iOS Build" in the subheading "Build", add -f to the "Additional arguments mtouch" and rebuild.

+1
source

In my case, I created actions for several buttons, and I accidentally made an exit, not an action. I just deleted the @IBOutlet line.

My mistake:

  this class is not key value coding-compliant for the key Button_Twitter_Clicked.' 

Again, in my case, I found my solution:

http://www.tech-recipes.com/rx/52021/how-do-i-fix-the-issue-this-class-is-not-key-value-coding-compliant-for-the-key- in-xcode-6 /

  - Click the "Show Find Navigator" on the left hand side - Search for the key above that gave the error, in my case it was the "Button_Twitter_Clicked" key. - Double click on the result (my case, I clicked on the View Controller:Outlet - On the right hand side, find the Key that was in the exception thrown during runtime (Has exclamation mark) (States that the view controller does not have an outlet named [outletname] - Click the X button - Recompile :) 

Hope this helps!

+1
source

I agree with Richard.

Another thing you can do is rebuild the project. This is the -f argument.

0
source

Although this is a relatively old topic, I wanted to share my experience. So I had the same problem and the โ€œcleaningโ€ did not work for me. My solution was: 1. Right-click your project, select "Options" 2. In the "Build" section, select "iOS Build 3.". In the linker options, select "Link all Assemblys".

0
source

Source: https://habr.com/ru/post/1484646/


All Articles