(NSMenuItem): missing setter or instance variable

后端 未结 3 526
醉话见心
醉话见心 2020-12-20 20:33

I am encountering a strange error:

2015-04-02 12:20:14.642 test[21167:257788] Failed to connect     
(testApp) outlet from (test.AppDelegate) to (NSMenuItem)         


        
3条回答
  •  温柔的废话
    2020-12-20 21:12

    This happens because you at one point created an @IBOutlet for a storyboard element. You then later removed the code (reference) from your swift file.

    I created an example where I create two extra @IBOutlets (I named them 'correctField' and 'incorrectField'- both are incorrect though) and connected them from my storyboard to my swift file. I then removed the code from my swift file. This generates the log as shown in the following figure :

    To remove this kind of log message, you can do the following:

    1. Go to the 'storyboard' and select the storyboard elements you created connections (@IBOutlets) from.
    2. Open the 'connection inspector' as showed in the figure below
    3. Remove the Referencing Outlets which are incorrect (in my case it is the 'correctField' and 'incorrectField')
    4. Done

    This was done in xCode 11

提交回复
热议问题