Very basic JSON to a TableView (iOS).

Discussion in 'iOS Programming' started by Throdne, Jul 30, 2012.

  1. Throdne, Jul 30, 2012
    Last edited: Jul 30, 2012

    Throdne macrumors newbie

    Joined:
    Jul 11, 2012
    #1
    Well, I decided that it's time to learn a new skill, programming objective-c. My programming knowledge is very minimal, It consists of PHP, little bit of HTML, and a little bit of MySQL. What I want to do is take some JSON that is made with php and populate a iOS table view.

    here is my json.php:

    <?php
    $array = array(1,2,3,4,5,6,7,8,9,10);
    $json = json_encode($array);
    echo $json;
    ?>

    My only problem is, is I have no idea where to start on how to use JSONKit framework. https://github.com/johnezang/JSONKit/ I would prefer to use JSONKit over the other alternatives just because it seems it has more support.

    NSString *strURL = [NSString stringWithFormat:mad:"http://api.tekop.net/json.php"];
    NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
    NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];
    NSLog(@"%@", strResult);

    I was able to print the results of the JSON page in the debug console. Now my only question is what next? I have tried to look for some tutorials online but all I could find was something more advanced Jason phraser. To advanced for my basic needs. I know my questions very vague and open to a lot of different answer, but I figured this is the place to ask these types of questions.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Starting with iOS 5, JSON support is built-in. You sure you need to use a third-party library?
     
  3. Throdne thread starter macrumors newbie

    Joined:
    Jul 11, 2012
    #3
    O, if ios 5 or later has built in Json, then no. I didn't know i had that option. Ever tutorial I have found online was using a third party json library plus it seemed like more widely used, even more used then the built in json.
     

Share This Page