I'mm using JSONModel to get the JSON from the URL. It's a very simple object, containing only 2 strings - "name" and "url".
First I made the Object Model:
@protocol
Tutorial
@end
@interface Tutorial : JSONModel
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *url;
@end
Then Object Feed:
#import "JSONModel.h"
#import "Tutorial.h"
@interface TutorialFeed : JSONModel
@property (nonatomic, strong) NSArray <Tutorial> *tutorials;
@end
and then in MasterViewController.m:
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "TutorialFeed.h"
#import "JSONModelLib.h"
@interface MasterViewController () {
TutorialFeed *feed;
TutorialFeed *testFeed;
}
@end
@implementation MasterViewController
-(void)viewDidAppear:(BOOL)animated
{
feed = [[TutorialFeed alloc]
initFromURLWithString:@"http://api.matematikfessor.dk/apps/teacher_videos"
completion:^(JSONModel *model, JSONModelError *err) {
NSLog(@"Tutorials %@", feed.tutorials);
}];
}
@end
The problem is, I get returned nil in my log :( Im not sure why is this happening, because I managed to fetch data from JSON from this URL: Kiwa URL
All that done, following this tutorial
Im not sure what am I doing wrong. Does anybody has any clue ?