Dictionary TO ARRAY

– (void)getStationDetailsMehtod{

    

    self.webService = [[WebServices alloc] init];

    

    NSArray *arrKeys,*arrValues;

    

    if ([[NSUserDefaults standardUserDefaults] objectForKey:@”UserInfo”] != nil) {

        arrKeys = [NSArray arrayWithObjects:@”station_id”,@”user_token”, nil];;

        arrValues = [NSArray arrayWithObjects:self.stationID,[[[NSUserDefaults standardUserDefaults] objectForKey:@”UserInfo”] objectForKey:@”sessiontoken”], nil];

    }

    else

    {

        arrKeys = [NSArray arrayWithObjects:@”station_id”, nil];;

        arrValues = [NSArray arrayWithObjects:self.stationID, nil];

    }

    

    NSDictionary *dicParameter = [NSDictionary dictionaryWithObjects:arrValues forKeys:arrKeys];

    [MBProgressHUD showHUDAddedTo:self.view animated:YES];

    

    [self.webService getStationWebServicesWithParameters:dicParameter success:^(id responce) {

        dic = [NSJSONSerialization JSONObjectWithData:responce options:NSJSONReadingAllowFragments error:nil];

        NSLog(@”Responce DATA = %@”,dic);

        [MBProgressHUD hideAllHUDsForView:self.view animated:YES];

        

        if ([[dic objectForKey:@”status”] integerValue] == 100) {

            

            NSLog(@”DIC:-%@”,dic);

            

                txtInformation.text = [[[dic objectForKey:@”message”] objectForKey:@”location”]objectForKey:@”city”];

               

                

                NSString *cityName;

                NSString *cityState;

                NSString *cityZip;

                

                cityName = [[[dic objectForKey:@”message”] objectForKey:@”location”]objectForKey:@”city”];

                cityState = [[[dic objectForKey:@”message”] objectForKey:@”location”]objectForKey:@”street”];

                cityZip = [[[dic objectForKey:@”message”] objectForKey:@”location”]objectForKey:@”zip”];

                

            [txtInformation  setText:[NSString stringWithFormat:@”%@\n%@\n%@”,cityName,cityState,cityZip]];

            

            [txtInformation setFont:[UIFont fontWithName:txtFontName size:15.0f]];

            

            for (int i = 0; i < [[[dic objectForKey:@”message”] objectForKey:@”bikes”] count]; i++) {

                

                if ([[[[[dic objectForKey:@”message”] objectForKey:@”bikes”] objectAtIndex:i] objectForKey:@”available”] integerValue] == 1) {

                    [self.arrayDataSources addObject:[[[dic objectForKey:@”message”] objectForKey:@”bikes”] objectAtIndex:i]];

                }

            }

            

        }

        

        

        [tblData reloadData];

        

    } failure:^(NSError *error) {

        NSLog(@”ERROR::: %@”,error.localizedDescription);

    }];

    

    

    

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s