Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should be able to get your NSData from the URL that returns the JSON using <code>[NSData dataWithContentsOfURL:yourURLValue]</code>, then pass the data and parse using something similar to what's below based on your JSON:</p> <pre><code> //INVOKE WEB SERVICE QUERY IN VIEW DID LOAD -- RUNS ASYNC SO WONT BLOCK UI - (void)viewDidLoad { [super viewDidLoad]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSData* data = [NSData dataWithContentsOfURL: @"URLOFYOURWEBSERVICE"]; // &lt;-- may need to cast string to NSURL.... NSMutableArray *quivernames = [self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES]; }); } - (NSMutableArray *)fetchedData:(NSData *)responseData { //parse out the json data NSError* error; //ARRAY OR DICT DEPENDING ON YOUR DATA STRUCTURE NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error]; //ITERATE AND/OR ADD OBJECTS TO YOUR NEW ARRAY NSMutableArray* JSONResultValues = [json objectForKey:@"yourKey"]; NSMutableArray* resultValues = [[NSMutableArray alloc] init]; for(int x = 0; x&lt; [JSONResultValues count]; x++){ NSDictionary *tempDictionary = [JSONResultValues objectAtIndex:x]; [resultValues addObject:[tempDictionary objectForKey:@"quivername"]]; } NSLog(@"Results Count: %@", [JSONResultValues count]); NSLog(@"Results Count: %@", [resultValues count]); return resultValues; } </code></pre> <p>EDIT: For more info check out this explanation for JSON parsing <a href="http://www.raywenderlich.com/5492/working-with-json-in-ios-5" rel="nofollow">http://www.raywenderlich.com/5492/working-with-json-in-ios-5</a> </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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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