Good afternoon: Help to deal with JSONModel. Link to screenshots https://yadi.sk/d/ClyoCyVMkoToC I had to make all the screens in one folder, because I can not add more than one link The problem:

The project accepts JSON from the site. NSlog looks like this (screenshot 1)

There is a model CatalogModel (screen 2)

Code that handles (screen 3)

When starting, I get an error (screen 4 and screen 5)

Cleaning the project does not help.

If I remove from the ListModel model, then everything works fine.

As I understand it, I am not correctly describing the model, but I took this example of description from the project page on the github.

  • judging from the fifth screenshot, the problem is that there are duplicate symbols in the CatalogModel and NTCatalogController classes. Check that you are not importing .m , and let's see what is in these classes. - Max Mikheyenko
  • No, .m is not exactly imported. The problem appears when in CatalogModel.h I add ListModel - Georgii Baruchyan
  • as I wrote, you need to see what happens in these classes. - Max Mikheyenko
  • yadi.sk/d/lBFjUkd0koyVw There are 4 files used here. - Georgii Baruchyan
  • so far nothing suspicious. is NTCatalogControllerDetail.h imported by CatalogModel? - Max Mikheyenko

1 answer 1

You have an @implementation ListModel located in the header, so when you import it into a view controller, it turns out that ListModel has two different implementations, which is from the compiler's point of view duplicate symbols (which you see in error).

What to do with it?

  • It is best not to add two classes into one file - ListModel separately, CatalogModel separately.
  • If this option does not suit you, simply transfer @implementation to .m

Another tip: rename the ListModel protocol to ListModelDelegate to avoid confusion.

  • Thanks, I will try in the evening. - Georgii Baruchyan
  • Max, thank you so much. You saved my nerves)) - Georgii Baruchyan
  • do not forget a tick :) - Max Mikheyenko