Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8379595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:13:56+00:00 2026-06-09T16:13:56+00:00

when I try my own data the NSLog for date returns null. Here is

  • 0

when I try my own data the NSLog for “date” returns null. Here is my json from the web page:

[{“date”:”2012-08-13 12:00:00″,”timezone_type”:3,”timezone”:”EST5EDT”},{“date”:”2012-08-13 10:00:00″,”timezone_type”:3,”timezone”:”EST5EDT”},{“date”:”2012-08-13 13:00:00″,”timezone_type”:3,”timezone”:”EST5EDT”}]

and here is my code: .m

#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
//#define kLatestKivaLoansURL [NSURL          URLWithString://@"http://api.kivaws.org/v1/loans/search.json?status=fundraising"]
#define kLatestKivaLoansURL [NSURL URLWithString:@"http://www.xxxxxxxxxxx.com/appointjson.php"]

#import "MyAvailTimesViewController.h"

@interface MyAvailTimesViewController ()

@end

@implementation MyAvailTimesViewController
@synthesize json;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    //Do any additional setup after loading the view.
    dispatch_async(kBgQueue, ^{
        NSData* data = [NSData dataWithContentsOfURL: 
                        kLatestKivaLoansURL];
        [self performSelectorOnMainThread:@selector(fetchedData:) 
                               withObject:data waitUntilDone:YES];

    });
}
- (void)fetchedData:(NSData *)responseData {
    //parse out the json data
    NSLog(@"%@",responseData);
    NSError* error;
    NSDictionary* json = [NSJSONSerialization 
                          JSONObjectWithData:responseData

                          options:kNilOptions 
                          error:&error];

    NSArray* latestLoans = [json objectForKey:@"date"];
    NSLog(@"date: %@", latestLoans);
    //NSLog(@"output2: %@", json);

.h

#import <UIKit/UIKit.h>

@interface MyAvailTimesViewController : UIViewController {
}

@property(nonatomic, retain) NSDictionary *json;
@end

The NS log when i responseData is:
2012-08-15 15:17:54.114 GBSB[480:15b03] <3c21444f 43545950 45206874 6d6c2050 55424c49 4320222d 2f2f5733 432f2f44 54442058 48544d4c 20312e30 20547261 6e736974 696f6e61 6c2f2f45 4e222022 68747470 3a2f2f77 77772e77 332e6f72 672f5452 2f786874 6d6c312f 4454442f 7868746d 6c312d74 72616e73 6974696f 6e616c2e 64746422 3e0a3c68 746d6c20 786d6c6e 733d2268 7474703a 2f2f7777 772e7733 2e6f7267 2f313939 392f7868 746d6c22 3e0a3c68 6561643e 0a3c7469 746c653e 47425342 204a534f 4e204665 65643c2f 7469746c 653e0a3c 2f686561 643e0a5b 7b226461 7465223a 22323031 322d3038 2d313320 31323a30 303a3030 222c2274 696d657a 6f6e655f 74797065 223a332c 2274696d 657a6f6e 65223a22 45535435 45445422 7d2c7b22 64617465 223a2232 3031322d 30382d31 33203130 3a30303a 3030222c 2274696d 657a6f6e 655f7479 7065223a 332c2274 696d657a 6f6e6522 3a224553 54354544 54227d2c 7b226461 7465223a 22323031 322d3038 2d313320 31333a30 303a3030 222c2274 696d657a 6f6e655f 74797065 223a332c 2274696d 657a6f6e 65223a22 45535435 45445422 7d5d3c62 6f64793e 0a0a3c2f 626f6479 3e0a3c2f 68746d6c 3e>

I am having a hard time finding a resolution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:13:57+00:00Added an answer on June 9, 2026 at 4:13 pm

    This:

    [{"date":"2012-08-13 12:00:00","timezone_type":3,"timezone":"EST5EDT"},{"date":"2012-08-13 10:00:00","timezone_type":3,"timezone":"EST5EDT"},{"date":"2012-08-13 13:00:00","timezone_type":3,"timezone":"EST5EDT"}]
    

    is an array, not a dictionary. When you perform [NSJSONSerialization JSONObjectWithData:... the returned object should be an NSArray. So when you call objectForKey: you should see an exception.

    If you’re getting nil then the only sensible conclusion is that the JSON data you’re asking to be parsed is malformed.

    Having checked the NSData you post, your server is actually returning:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>GBSB JSON Feed</title>
    </head>
    [{"date":"2012-08-13 12:00:00","timezone_type":3,"timezone":"EST5EDT"},{"date":"2012-08-13 10:00:00","timezone_type":3,"timezone":"EST5EDT"},{"date":"2012-08-13 13:00:00","timezone_type":3,"timezone":"EST5EDT"}]<body>
    
    </body>
    </html>
    

    Which clearly isn’t valid JSON; it’s an HTML document that happens to display JSON.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am loading in data to a UITableView , from a custom UITableViewCell (own
I try to create my own linux bash script that calls truecrypt for mounting.
I try to add the android coverflow in my own android projet when myt
I try to implement an initialization method for my own type. However after calling
I created my own class but when I try to instantiate it I run
I've seen a lot of people try to code their own image conversion techniques.
I have my own templatetag: @register.inclusion_tag('path_to_module.html', takes_context=True) def getmodule(context, token): try: return slow_function(params) except
I try to decrypt data that was originally encrypted with Objective-C in Java. There
I am trying to send data from an Android app to a PHP file
I am trying to get some data from the user and send it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.