iOS Web Service: Move connection call from AppDelegate -



iOS Web Service: Move connection call from AppDelegate -

so i've been working on fetching info web service , using in app (e.g displaying bunch of names in uitableview)...

the guide have been next setting up, set nsurlconnection in appdelegate, had xmlparser , object storing fetched data... now, want move connection set-up out , phone call appdelegate , class of it's own... i'm bit unsure approach...

i'm thinking along line of:

child (object storing data)

childparser (nsxmlparser)

someviewcontroller (receives update notification parser , uses data)

childmsg (set connection , soap message here)

okay, before appdelegate set connection , soap message in didfinishlaunchingwithoptions... , in connectiondidfinishloading initialized childparser... in viewcontroller initiliazed parser with:

appdelegate = (appdelegate *)[[uiapplication sharedapplication] delegate];

and access kid info objects...

okay, i'm thinking should not setting connection in appdelegate i'm going have 3-4 different connections , bunch of soap messages each connection, create mess of appdelegate class... therefore, i'm thinking i'll create class each of different web service calls , initialize these classes in viewcontroller when need them... how this?

before had in parser:

- (xmlparser *) initxmlparser { self = [super init]; if(self) { appdelegate = (appdelegate *)[[uiapplication sharedapplication] delegate]; } homecoming self; }

which used initialize in appdelegate, i'm guessing i'll need similar in childmsg

this rambling doesn't create sense, understood want accomplish , can give me nudge in right direction...

short summary: i'm parsing info web service, , want info in viewcontroller, want set connection , soap message place appdelegate..

thanks in advance

i suggest trying follow mvc (model view controller) approach here. think have pretty clear view , controller classes are; model set soap/xml code (or in class access model).

in case, add together ivar controller represent model class. model class should offer methods update content (i.e., info web service) , retrieve single pieces of info controller makes available view manages. model class encapsulate connection/request handling code, , (possibly, if understand things correctly) access childparser build kid objects (that view utilize display content).

this rough sketch of how things work. if need more info mvc, have wikipedia. hope helps.

ios web-services class soap delegates

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -