开发者

Fill Table View with JSON

Here goes a newbie question:

  1. Create a new project in Xcode: File > New Project and select Navigation-based Application from iPhone OS templates.

  2. Install json-framework as explained here.

  3. Edit RootViewController.h's interface section into this:

    @interface RootViewController : UITableViewController {
        NSURLRequest *request;
        NSURLConnection *theConnection;
        NSMutableData *receivedData;
        NSArray *faculties;
    }
    
  4. Edit RootViewController.m and implement a cou开发者_StackOverflowple of simple things. Replace <your_domain_name_goes_here> with a valid domain name where a web service will answer to your calls.

  5. URL above will output a JSON string like this.

  6. Now, if you build&run this code, in debugger console you'll get:

    Attaching to process 35594.
    2010-07-19 13:15:31.307 WSMobileTest[35594:207] Succeeded! Received 580 bytes of data
    Program received signal:  “EXC_BAD_ACCESS”.
    

Any ideas?

Developer Information:

Version:        3.2 (10M2262)
Location:       /Developer
Applications:
    Xcode:              3.2.3 (1688)
    Interface Builder:  3.2.3 (788)
    Instruments:        2.7 (2529)
    Dashcode:           3.0.1 (330)
SDKs:
    Mac OS X:
        10.5:   (9L31a)
        10.6:   (10M2262)
    iPhone OS:
        3.2:    (7B367)
        4.0:    (8A293)
    iPhone Simulator:
        3.2:    (7W367a)
        4.0:    (8A293)


Congratulations: You've included everything except the line that causes the crash. Set a breakpoint and step through the debugger until it crashes, or look at the backtrace, or something.

In this case, I think you mean faculties = [[jsonString JSONValue] retain;.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜