Note that there are some explanatory texts on larger screens.

plurals
  1. POios - How to load data from JSON url in UITableView?
    primarykey
    data
    text
    <p>I'm new to iPhone development,I'm trying to bind data from <code>JSON</code> Url in <code>UITableview</code>, but I'm getting an error in the below code.</p> <pre><code>- (void)viewDidLoad { SBJsonParser *parser = [[SBJsonParser alloc] init]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://80f237c226fa45aaa09a5f5c82339d46.cloudapp.net/DownloadService.svc/Courses"]]; NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; statuses = [parser objectWithString:json_string error:nil]; [self.dropdownTblView reloadData]; for (NSDictionary *status in statuses) { _altTitle = [status valueForKey:@"Title"]; NSLog(@"Title %@",_altTitle); } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"%d",[statuses count]); return [statuses count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } return cell; //Here I'm getting an error id obj = [statuses objectAtIndex:indexPath.row]; NSString *name = [obj valueForKey:@"Title"]; cell.textLabel.text =name; return cell; } </code></pre> <p>This is my JSON </p> <pre><code>[ { "Id": 1, "Title": "Tamil to English", "AltTitle": "த|மி|ழ்| |மூ|ல|ம்| |ஆ|ங்|கி|ல|ம்", "Description": "Learn English through Tamil", "Code": 1, "Version": "1.0", "SourceLanguageIndicator": "அ", "TargetLanguageIndicator": "A", "SourceLanguageCode": "ta", "TargetLanguageCode": "en", "Updated": "2013-02-21T03:33:19.6601651+00:00" } ] </code></pre> <p>Any ideas? Thanks in advance.</p>
    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