Friday, 15 January 2010

objective c - AFURLConnectionOperation 'start' method gets called before it is ready and never gets called again afterwards -



objective c - AFURLConnectionOperation 'start' method gets called before it is ready and never gets called again afterwards -

we utilize afnetworking (https://github.com/afnetworking/afnetworking) in our app , nsoperationstack (https://github.com/nicklockwood/nsoperationstack) set dependencies lastly operation gets priority on rest in queue (stack behavior). running issue when 'start' method of afurlconnectionoperation gets called, operation's 'isready' method returns no because of dependencies. makes 'start' exit immediately. after first effort start operation, 'start' method never gets called again, operation never reaches isfinished state, never gets deleted queue , operations jam queue. appreciate thought on matter. give thanks you!

more info: none of operations got cancelled , don't see dependency circles in queue. utilize setlifodependendenciesforoperation on existing operationqueue not changing afnetworking code: [self.operationqueue setlifodependendenciesforoperation:operation];

update: now, thinking more it, possible have 0 dependencies @ 1 point , having isready homecoming yes when nsoperationqueue decides operation ready, but, time, start() gets invoked number of dependencies changes 1 or more.

this sounds issue 'ns'operationstack github project using.

changing nsoperation dependancies after have been added nsoperationqueue advised against in documentation:

important should configure dependencies before running operations or adding them operation queue. dependencies added afterward may not prevent given operation object running. (from: concurrency programming guide: configuring interoperation dependencies)

i think improve approach maintain own lifo stack outside operation queue , utilize finishing of 1 operation trigger queuing of next of import operation.

or if don't need strict perhaps utilize -[nsoperation setpriority:] prioritise later operations on before ones.

objective-c afnetworking nsoperation

No comments:

Post a Comment