« first day    last day (29 days later) » 

12:55 AM
I have only extracted the text for the item as I didn't have your Item class and your XML didn't contain the additional information, but hopefully you can work it out
 
great let me take a look
dose this only do it for the deli items?
 
1:20 AM
I have updated the Gist to include a couple of view controllers to drive table views that show how to use the data. The code parses the 7 days into 7 top level arrays. From these arrays you can obtain the meals on each day, the counters in each meal and finally the items at each counter
 
this is all that in my items.h file
#import <Foundation/Foundation.h>

@interface Items : NSObject

@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *url;

@end
and items.m is empty
 
1:41 AM
Ok. I will update the code...
 
1:51 AM
I have updated the code to create Item objects at the lowest level
 
2:48 AM
okay I see. So just to clarify the class deliData gets all the counters and such...?
and items
 
Yes.
If you look through the two view controllers in the Gist you can see how I start with a day (section header for the first table view) and put the meals for each day into the rows of the section. The second table view controller puts the counters for the selected day/meal into the section heading and the items into the rows
If you look in viewDidLoad of ViewController.m you will see where i load the DeliData instance from an XML file - you would use your HTTP data rather than a text file as I did for testing
 
right I would use something like this to load it from a url...
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
//then call method in here
}
?
 
Yep, you can simple say self.deliData=[[DeliData alloc] init:data];
 
Also one more thing I just realized, I have viewController A where user selects location which goes to viewController B, where the user selects their meal which goes to the info being displayed. I want your ViewController in the Gist to be my ViewController B correct?
 
Sounds like it. There was no location in the XML, but I guess you would retrieve that by using the appropriate URL?
 
3:04 AM
correct thanks
 
Also my view controller shows the whole week - you may want to just show "todays" meals in which case the meals would be the section with the counters as the rows
 
right okay let me implement it in
 
3:21 AM
are you setting up your view controller class as a tableview controller that displays the meals available?
 
3:32 AM
My first ViewController isn't a table view controller (although it could be) - it is just a normal view controller to which I added a table view - this was because it was the view controller I inherited from the project template in Xcode and I couldn't be bothered refactoring it. The second view controller (MenuTableViewController) is a TableViewController because I added it to the project
 
kk thanks
is this code in a project you could add to gitHub as that might be easier for me to follow?
 
You can download the project here - wilko.me/deliparser.zip
 
great i see this error when i run
linker command failed with exit code 1 (use -v to see invocation)
do i need to add frameworks
 
You shouldn't need to. Try a build->clean
 
didn't work
the clean successed but the run doesn't work
 
3:40 AM
Also, make sure you open the XCWorkspace, not the project, otherwise it won't pick up the TFHpple pod
 
that was the prob thanks
 
No worries. Where are you anyway? I get the feeling you are a fair way from my timezone
 
ya its getting late here so I'm going to go to bed, and i don't have anything to do tomorrow so now that I have the project I should be able to get it and ill add that bounty :) I'm in usa btw
 
I thought you were in the US based on the times you were active overnight. I am in Sydney Australia. Night.
 
 
15 hours later…
6:45 PM
Guessing your not awake as its early in Australia, but I am just having trouble calling the data from the web
 
7:08 PM
previosuly I have loaded data like this
- (void)viewDidLoad {
[super viewDidLoad];
[self loadDataUsingNSURLConnection];
}
- (void) loadDataUsingNSURLConnection {

NSString *url = @"URL";

[self getMenuItems:url];


}
- (void)getMenuItems:(NSString*)url{

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
//NSLog(@"response == %@", response);


//make call to DeliItems.m here? to get data?
}];

}
I am trying to call this -(void)parseXML:(NSData *)menuData {} in getMenuItems like this: [MealData parseXML:data]; but I can't?
 

« first day    last day (29 days later) »