problem with NSDictionary and JSON

Discussion in 'iPhone' started by macroshan, Apr 6, 2009.

  1. macroshan macrumors newbie

    Joined:
    Mar 19, 2009
    #1
    Hello,

    I have to separate the tokens from the contents of URL
    But didnt get the required result
    Following are the code lines
    Any help will be appreciated!! I am new to iphone...
    So please help!!!

    NSURL *url = [NSURL URLWithString:mad:"http://example.com//sample.php"];
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url];

    NSError *error=NULL;

    NSData *result = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];

    NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:result error:&error];

    NSMutableString *rowData;
    int i;

    for ( i=0 ; i < [[dictionary objectForKey:mad:"question"] count] ; i++)
    {
    [rowData appendFormat:mad:"%@ \n",[[[ dictionary objectForKey:mad:"question"] objectAtIndex:i] objectForKey:mad:"title"]];
    }

    [QLabel setText:rowData ];
     
  2. mavis macrumors 68040

    mavis

    Joined:
    Jul 30, 2007
    Location:
    Tokyo, Japan
    #2
    There is an iPhone Programming forum, you know. You'll probably get much more helpful - and friendly - replies there. ;)
     

Share This Page