Could not insert new outlet connection error

后端 未结 21 1380
南方客
南方客 2020-12-14 01:29

I have created a custom cell for loading into a table. The interface is complete and now I am trying to link the xib and the class.

I have the split screen view open

相关标签:
21条回答
  • 2020-12-14 02:08
    1. Remove .m file from compoile sources and add again.
    2. clean and build your project.
    3. Restart xcode.

    In my case, #1 fixed the issue

    0 讨论(0)
  • 2020-12-14 02:09

    I have the reported problem trying to add a new Watch target to an old project as I successfully did several times on blank projects following tutorials. I tried inserting the target an scheme and removing both the files, the targets and schemes, as well restarting Xcode and deleting the derived files many times. But each time I recreate the target and try to activate the Assistant Editor, it finds no correspondent file to the main storyboard, and if I manually select it and then try to drag a new outlet I get the error of the original poster. What else could it be? As a metter fo fact my error is quite different as you may see in the screenshot.

    0 讨论(0)
  • 2020-12-14 02:09

    delete your custom cell(tableview cell) and add again with different name. It works.

    0 讨论(0)
  • 2020-12-14 02:11

    This problem seems to be an Xcode bug which creeps up mostly when you replace a file with a new file of the same name. Xcode seems to keep a reference of the older file of the same name.

    Anyhow, the way to fix this seems to be -

    1. Clean the project

    2. Click <Your Project> in Project Navigator view. Go to Compile Sources under Build Phases of the target for which you are building. Remove and add back the .m file which is giving you trouble.

    3. Alternatively, in the File Inspector (Utilities view) of the NIB file, under Target Membership, uncheck and check back the target name.

    4. Restart Xcode for good measure.

    5. Of course, deleting and adding back the .m file alone should fix it too.

    Steps 1. and 2. alone fixed it for me. Feel free to ask if any step needs expanding.

    Cheers and happy coding :)

    0 讨论(0)
  • 2020-12-14 02:14

    I had the same problem for a viewcontroller which was removed accidantly.I readded files to project but adding Outlets by draging with from xib file gave me the mentioned error.I cleaned the project and restarted XCode and everything worked fine again.

    0 讨论(0)
  • 2020-12-14 02:16

    Just go to .m file

    remove

    #import "calssName.h" 
    

    save file

    add text again

    #import "calssName.h"

    save file

    0 讨论(0)
提交回复
热议问题