Reputation: 11201
I am following the tutorial provided in http://www.appcoda.com/fetch-parse-json-ios-programming-tutorial/ , i downloaded the code and try to run it. When the app launches,i am getting the blank table view . I am supposed to get the JSON data from the website and display it in the table view.
Somehow,the fetching group method is not getting called in my view did load method
@interface MasterViewController () <MeetupManagerDelegate> {
NSArray *_groups;
MeetupManager *_manager;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_manager = [[MeetupManager alloc] init];
_manager.communicator = [[MeetupCommunicator alloc] init];
_manager.communicator.delegate = _manager;
_manager.delegate = self;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startFetchingGroups:)
name:@"kCLAuthorizationStatusAuthorized"
object:nil]; // this should fetch the groups from the website but it isnt doing anything
}
#pragma mark - Notification Observer
- (void)startFetchingGroups:(NSNotification *)notification
{
[_manager fetchGroupsAtCoordinate:self.locationManager.location.coordinate];
}
Can anyone tell me what i am missing?
Upvotes: 0
Views: 120
Reputation: 1097
The NSNotificationCenter "kCLAuthorizationStatusAuthorized" is never posted from the AppDelegate.m.
When the app runs, it is supposed to ask you if you for authorization before it can use location to browse Meetup. For some reason, it is not asking for authorization. This may have something to do with the code being a few years old and now out of date compared to iOS8.
Try this tutorial, which is a bit newer: http://www.appcoda.com/parse-xml-and-json-web-service/
Also, to just see how to parse JSON just from a text file (top answer): How do I parse JSON from a file in iOS?
Upvotes: 1