iphone - Saving Twitter Streaming APIs results -


hi after lot of hassle managed work way around achieving , delimiting json returned twitter streaming apis. how store data returned [nsjsonserialization jsonobjectwithdata:options:error:] array in appending mode???

here codes call streaming api

self.twitterconnection = [[nsurlconnection alloc] initwithrequest:signedreq delegate:self startimmediately: no];

and in delegate method (which did receive data method)

nserror *parseerror = nil; self.datasource=[nsjsonserialization jsonobjectwithdata:[string datausingencoding:nsutf8stringencoding] options:nsjsonreadingallowfragments|nsjsonreadingmutablecontainers error:&parseerror]; want store nsjsonserialized output in static array(preferably in append mode) can pass table view display. how go it?

thanks in advance

edit

`self.datasource1=[[nsmutablearray alloc]init];

nsstring *string = [[nsstring alloc] initwithdata:data encoding:nsasciistringencoding];

string = [nsstring stringwithformat:@"[%@]", [string

stringbyreplacingoccurrencesofstring:@"\r\n" withstring:@","]]; nserror *parseerror = nil; self.datasource =[nsjsonserialization jsonobjectwithdata:[string datausingencoding:nsutf8stringencoding] options:nsjsonreadingallowfragments|nsjsonreadingmutablecontainers error:&parseerror];

[self.datasource1 addobjectsfromarray:self.datasource];`

use -[nsmutablearray addobjectsfromarray:] add objects mutable array.

based on comment, looks you're recreating self.datasource1 every time data in didreceivedata. should create object once before sending request.


Comments

Popular posts from this blog

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -