We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Everything is working fine , but after user gives the permission , my delegate methods are not called ...
Here is my entire class :
// // CheckInViewController.m // Lokaos // // Created by Andy Delarge on 15/08/12. // //
@interface CheckInViewController ()<BZFoursquareRequestDelegate, BZFoursquareSessionDelegate> @Property(nonatomic,readwrite,strong) BZFoursquare *foursquare; @Property(nonatomic,strong) BZFoursquareRequest *request; @Property(nonatomic,copy) NSDictionary *meta; @Property(nonatomic,copy) NSArray *notifications; @Property(nonatomic,copy) NSDictionary *response;
enum { kAuthenticationSection = 0, kEndpointsSection, kResponsesSection, kSectionCount };
enum { kAccessTokenRow = 0, kAuthenticationRowCount };
enum { kSearchVenuesRow = 0, kCheckInRow, kAddPhotoRow, kEndpointsRowCount };
enum { kMetaRow = 0, kNotificationsRow, kResponseRow, kResponsesRowCount };
@implementation CheckInViewController @synthesize foursquare = foursquare_; @synthesize request = request_; @synthesize meta = meta_; @synthesize notifications = notifications_; @synthesize response = response_;
(id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { self.foursquare = [[BZFoursquare alloc] initWithClientID:kClientID callbackURL:kCallbackURL]; foursquare_.version = @"20111119"; foursquare_.locale = [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]; foursquare_.sessionDelegate = self; } return self; }
(void)viewDidLoad { [super viewDidLoad]; self.navigationController.navigationBar.tintColor = [UIColor blackColor]; foursquare_.sessionDelegate = self; }
(void)viewWillAppear:(BOOL)animated {
if (![foursquare_ isSessionValid]) { [foursquare_ startAuthorization]; }
[Flurry logEvent:@"CheckIn"]; [super viewWillAppear:YES];
[self viewDidLoad]; }
(void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. }
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 8; }
(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; }
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentfier = @"cellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentfier];
if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentfier]; }
cell.textLabel.textColor = [UIColor whiteColor];
switch (indexPath.section) { case kAuthenticationSection: if (![foursquare_ isSessionValid]) { cell.textLabel.text = NSLocalizedString(@"Obtain Access Token", @""); } else { cell.textLabel.text = NSLocalizedString(@"Forget Access Token", @""); } break; case kResponsesSection: { id collection = nil; switch (indexPath.row) { case kMetaRow: collection = meta_; break; case kNotificationsRow: collection = notifications_; break; case kResponseRow: collection = response_; break; } if (!collection) { cell.textLabel.enabled = NO; cell.detailTextLabel.text = nil; cell.selectionStyle = UITableViewCellSelectionStyleNone; } else { cell.textLabel.enabled = YES; NSUInteger count = [collection count]; NSString *format = (count == 1) ? NSLocalizedString(@"(%lu item)", @"") : NSLocalizedString(@"(%lu items)", @""); cell.detailTextLabel.text = [NSString stringWithFormat:format, count]; cell.selectionStyle = UITableViewCellSelectionStyleBlue; } } break; }
return cell; }
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 80; }
@EnD
I dont know what Im doing wrong since I set myself as the delegate, and implement them ... Thanks for any help !
t know what I
The text was updated successfully, but these errors were encountered:
Does our sample app work? The app works on our environment.
Sorry, something went wrong.
No branches or pull requests
Everything is working fine , but after user gives the permission , my delegate methods are not called ...
Here is my entire class :
//
// CheckInViewController.m
// Lokaos
//
// Created by Andy Delarge on 15/08/12.
//
//
import "CheckInViewController.h"
import "Flurry.h"
import "FSQJSONObjectViewController.h"
import "Constantes.h"
@interface CheckInViewController ()<BZFoursquareRequestDelegate, BZFoursquareSessionDelegate>
@Property(nonatomic,readwrite,strong) BZFoursquare *foursquare;
@Property(nonatomic,strong) BZFoursquareRequest *request;
@Property(nonatomic,copy) NSDictionary *meta;
@Property(nonatomic,copy) NSArray *notifications;
@Property(nonatomic,copy) NSDictionary *response;
@EnD
enum {
kAuthenticationSection = 0,
kEndpointsSection,
kResponsesSection,
kSectionCount
};
enum {
kAccessTokenRow = 0,
kAuthenticationRowCount
};
enum {
kSearchVenuesRow = 0,
kCheckInRow,
kAddPhotoRow,
kEndpointsRowCount
};
enum {
kMetaRow = 0,
kNotificationsRow,
kResponseRow,
kResponsesRowCount
};
@implementation CheckInViewController
@synthesize foursquare = foursquare_;
@synthesize request = request_;
@synthesize meta = meta_;
@synthesize notifications = notifications_;
@synthesize response = response_;
(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
self.foursquare = [[BZFoursquare alloc] initWithClientID:kClientID callbackURL:kCallbackURL];
foursquare_.version = @"20111119";
foursquare_.locale = [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode];
foursquare_.sessionDelegate = self;
}
return self;
}
(void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
foursquare_.sessionDelegate = self;
}
(void)viewWillAppear:(BOOL)animated {
if (![foursquare_ isSessionValid]) {
[foursquare_ startAuthorization];
}
[Flurry logEvent:@"CheckIn"];
[super viewWillAppear:YES];
[self viewDidLoad];
}
(void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
pragma mark - UITableView DataSource Methods
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 8;
}
(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentfier = @"cellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentfier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentfier];
}
cell.textLabel.textColor = [UIColor whiteColor];
switch (indexPath.section) {
case kAuthenticationSection:
if (![foursquare_ isSessionValid]) {
cell.textLabel.text = NSLocalizedString(@"Obtain Access Token", @"");
} else {
cell.textLabel.text = NSLocalizedString(@"Forget Access Token", @"");
}
break;
case kResponsesSection:
{
id collection = nil;
switch (indexPath.row) {
case kMetaRow:
collection = meta_;
break;
case kNotificationsRow:
collection = notifications_;
break;
case kResponseRow:
collection = response_;
break;
}
if (!collection) {
cell.textLabel.enabled = NO;
cell.detailTextLabel.text = nil;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
} else {
cell.textLabel.enabled = YES;
NSUInteger count = [collection count];
NSString *format = (count == 1) ? NSLocalizedString(@"(%lu item)", @"") : NSLocalizedString(@"(%lu items)", @"");
cell.detailTextLabel.text = [NSString stringWithFormat:format, count];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
}
}
break;
}
return cell;
}
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80;
}
pragma mark -
pragma mark BZFoursquareRequestDelegate
self.meta = request.meta;
self.notifications = request.notifications;
self.response = request.response;
self.request = nil;
[self updateView];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
NSLog(@"%s: %@", PRETTY_FUNCTION, error);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:[[error userInfo] objectForKey:@"errorDetail"] delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil];
[alertView show];
self.meta = request.meta;
self.notifications = request.notifications;
self.response = request.response;
self.request = nil;
[self updateView];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
pragma mark -
pragma mark BZFoursquareSessionDelegate
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:kAccessTokenRow inSection:kAuthenticationSection];
NSArray *indexPaths = [NSArray arrayWithObject:indexPath];
[self.tableView reloadData];
[self.tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
}
NSLog(@"%s: %@", PRETTY_FUNCTION, errorInfo);
}
pragma mark Anonymous category
if ([self isViewLoaded]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
[self.tableView reloadData];
if (indexPath) {
[self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
}
}
if (request_) {
request_.delegate = nil;
[request_ cancel];
self.request = nil;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
}
[self cancelRequest];
self.meta = nil;
self.notifications = nil;
self.response = nil;
}
[self prepareForRequest];
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:@"40.7,-74", @"ll", nil];
self.request = [foursquare_ requestWithPath:@"venues/search" HTTPMethod:@"GET" parameters:parameters delegate:self];
[request_ start];
[self updateView];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
[self prepareForRequest];
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:@"4d341a00306160fcf0fc6a88", @"venueId", @"public", @"broadcast", nil];
self.request = [foursquare_ requestWithPath:@"checkins/add" HTTPMethod:@"POST" parameters:parameters delegate:self];
[request_ start];
[self updateView];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
[self prepareForRequest];
NSURL *photoURL = [[NSBundle mainBundle] URLForResource:@"TokyoBa-Z" withExtension:@"jpg"];
NSData *photoData = [NSData dataWithContentsOfURL:photoURL];
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:photoData, @"photo.jpg", @"4d341a00306160fcf0fc6a88", @"venueId", nil];
self.request = [foursquare_ requestWithPath:@"photos/add" HTTPMethod:@"POST" parameters:parameters delegate:self];
[request_ start];
[self updateView];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@EnD
I don
t know what I
m doing wrong since I set myself as the delegate, and implement them ...Thanks for any help !
The text was updated successfully, but these errors were encountered: