Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to assign values from NSMutableDictionary to NSArray
    primarykey
    data
    text
    <p>I am doing JSON parsing and I want to show my parsed data in a <code>UITableView</code>.</p> <p>For that, I am trying to assign parsed data from <code>NSMutableDictionary</code> to <code>NSArray</code> to show in the table view but the array returns <code>null</code>.</p> <p>Here my array returns <code>null</code> value;</p> <pre><code>NSMutableDictionary *tempDict1; NSArray *arr = [[tempDict1 valueForKey:@"rates"] componentsSeparatedByString:@";"]; </code></pre> <p>code</p> <pre><code>- (void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; self.responseData = nil; // NSArray *latestrates = [[responseString JSONValue] objectForKey:@"rates"]; [responseString release]; values = [responseString JSONValue]; array = [[NSMutableArray alloc] init]; array = [values valueForKey:@"rates"]; NSLog(@"array values:--&gt; %@",array); tempDict1 = (NSMutableDictionary *)array; arr = [[tempDict1 valueForKey:@"rates"] componentsSeparatedByString:@";"]; NSString *subStar = @"="; NSMutableArray *arrTitle = [[NSMutableArray alloc] init]; NSMutableArray *arrValues = [[NSMutableArray alloc] init]; [arrTitle removeAllObjects]; [arrValues removeAllObjects]; for (int i=0; i&lt;[arr count]-1; i++) { [arrTitle addObject:[[arr objectAtIndex:i] substringToIndex:NSMaxRange([[arr objectAtIndex:i] rangeOfString:subStar])-1]]; [arrValues addObject:[[arr objectAtIndex:i] substringFromIndex:NSMaxRange([[arr objectAtIndex:i] rangeOfString:subStar])]]; NSLog(@"arrTitle is:--&gt; %@",arrTitle); } tempDict1 = (NSMutableDictionary*)[array objectAtIndex:0]; array = [values valueForKey:@"rates"]; NSLog(@"tempDict--%@",tempDict1); [arr retain]; [tbl_withData reloadData]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload