ios - Resolving MVC chaos -


the following setup:

  • controller (.h/.m)
  • connectionmanager (.h/.m) - sends requests using afnetworking
  • requesthandler (.h/.m) - build request params
  • keymanager (.h/.m) - writes database

i have send request server data keymanager.

here request sent using afnetworking in connectionmanager. request parameters , url request constructed requesthandler

but problem in order construct request have data requested controller , when initialize controller inside requesthandlers throws error controller type can't found

controller -> connectionmanager -> requesthandler -> controller -> connectionmanager -> server

please me dismantle mess or solution. how pass current instance of class new instance of class.

the best option resolve these kind of circular definitions use #import directives in .m files , instead use @class in .h files.

so if need reference class x in api class y, in y.h, add @class x, in y.m, add #import x

@class defines symbol. tells compiler "trust me, i'll tell later". hold true promise using #import in implementation of class.

this should solve problem.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -