ios - Resolving MVC chaos -
the following setup:
controller
(.h/.m)connectionmanager
(.h/.m) - sends requests using afnetworkingrequesthandler
(.h/.m) - build request paramskeymanager
(.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
Post a Comment