Giter Site home page Giter Site logo

foursquare-ios-api's People

Contributors

baztokyo avatar gooichi avatar kongmingstrap avatar markdorison avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

foursquare-ios-api's Issues

Client defaults to requests without version param

When a client is instantiated without a version param, it defaults to making requests without a version. This has been deprecated behavior for some time and soon the API will stop supporting requests without a version and return an error instead of an actual result. Please take some time to update your library to support this so that other developers using your library have the opportunity to upgrade to a working version.

getting 500 Internel Server Error all the time

Hi my friend
I followed your tutorial and could use my own URL and clientID successfully login to foursquare, but everytime I click allow, there pop up a error page said 500 Internel Server Error.
on the website it says that's wrong page with database problem, but I think the app is supposed to lead me back to it, however it isn't.
I wonder I missed something or this is just some techinical errors there which is shouldn't.

Thank you !
Howard

Problems calling the delegate methods

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;

  • (void)updateView;
  • (void)cancelRequest;
  • (void)prepareForRequest;
  • (void)searchVenues;
  • (void)checkin;
  • (void)addPhoto;
    @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

  • (void)requestDidFinishLoading:(BZFoursquareRequest *)request {
    self.meta = request.meta;
    self.notifications = request.notifications;
    self.response = request.response;
    self.request = nil;
    [self updateView];
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    }
  • (void)request:(BZFoursquareRequest *)request didFailWithError:(NSError *)error {
    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

  • (void)foursquareDidAuthorize:(BZFoursquare *)foursquare {
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:kAccessTokenRow inSection:kAuthenticationSection];
    NSArray *indexPaths = [NSArray arrayWithObject:indexPath];
    [self.tableView reloadData];
    [self.tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
    }
  • (void)foursquareDidNotAuthorize:(BZFoursquare *)foursquare error:(NSDictionary *)errorInfo {
    NSLog(@"%s: %@", PRETTY_FUNCTION, errorInfo);
    }

pragma mark Anonymous category

  • (void)updateView {
    if ([self isViewLoaded]) {
    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
    [self.tableView reloadData];
    if (indexPath) {
    [self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
    }
    }
    }
  • (void)cancelRequest {
    if (request_) {
    request_.delegate = nil;
    [request_ cancel];
    self.request = nil;
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    }
    }
  • (void)prepareForRequest {
    [self cancelRequest];
    self.meta = nil;
    self.notifications = nil;
    self.response = nil;
    }
  • (void)searchVenues {
    [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;
    }
  • (void)checkin {
    [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;
    }
  • (void)addPhoto {
    [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;
    }
  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }

@EnD

I dont know what Im doing wrong since I set myself as the delegate, and implement them ...
Thanks for any help !

userless requests

It would be VERY nice to have api for userless requests. Like list of nearby venues.

How to get Photo details

HI,
i had add photo with this demo application but now i want to get uploaded photo details with id ,
i had tray with
https://api.foursquare.com/v2/photos/PHOTO_ID
but i didnt get any response

this is URL which i am testing ,

https:/api.foursquare.com/v2/photos?oauth_token=APV1DJMP0MX3KX1F2HGWJ0XUYEHNHVWDENVIEA5BOY33TGSE&PHOTO_ID=51935629498e9b106a00f418&v=20111119&locale=en

Thanks ,

URL callback issue

Not sure if this is an actual issue or not but it could be problematic based on the input on the site. At the moment the site only allows you to put in callback urls as:
type://value
I was having issues with line 104 of BZFoursquare where it was always returning no not recognizing the full path as a prefix:

if (![[url absoluteString] hasPrefix:callbackURL_]) {
    return NO;
}

Adding a category and changing to use this fixes it for me:

NSString *urlString = [url absoluteString];
if([urlString rangeOfString:callbackURL_ options:NSCaseInsensitiveSearch].location == NSNotFound){
    return NO;
} 

Anyway something to have here in case anyone has issues.

Potential issue with different callback URL's

Hi,

I'm an iOS newbie to say the least. I managed to get your demo app working through xcode, and was able to authenticate correctly. I set my Foursquare Developer app to use the same callback URL as you, which is fsqdemo://foursquare. Everything worked on the iOS simulator.

I then created my own iPhone app. I continued to use fsqdemo://foursquare as the callback URL. However, when clicking "Allow", it would open up your demo app running on the same simulator instance instead of returning to my app. I figured your demo app had somehow registered to handle fsqdemo://foursquare across the system.

So I went back into Foursquare, and changed the url to myapp://foursquare, and changed the user-defined variable in my app to use the same callback url. When I call startAuthorization, the Safari page comes up as expected. When I click "Allow", I get a message that says "Safari cannot open the page because the address is invalid."

So it seemed like the fsqdemo://foursquare URL continued to be registered as a valid handler, while my app cannot use myapp://foursquare. Do I need to somehow clean off the simulator and remove your demo app in order to make it work? Or is there something special about the fsqdemo://foursquare URL that I'm missing?

Again, I'm dabbling in iOS/Obj-C for the first time here, and not sure how to proceed.

Thoughts?

Question: Xcode User-Defined Build Settings

I see in the FSQDemo sample project that the user-defined build settings created for the target are referenced in FSQMasterViewController.m as seen below:

#define kClientID       FOURSQUARE_CLIENT_ID
#define kCallbackURL    FOURSQUARE_CALLBACK_URL

When I try to do this in my own project, I get an error at compile time stating 'Use of undeclared identifier FOURSQUARE_CLIENT_ID'. Do I need to do something else to gain access to those user-defined build settings?

Documentation: MobileCoreServices Framework needs to be added to Linked Binaries

When following the documented instructions with a new app, the app will not build. I tracked this down to being that the MobileCoreServices framework needed to be linked in the project.

Below are the errors that I am presented with on build:

Undefined symbols for architecture i386: "_UTTypeCreatePreferredIdentifierForTag", referenced from: __BZGetMIMETypeFromFilename in BZFoursquareRequest.o "_UTTypeCopyPreferredTagWithClass", referenced from: __BZGetMIMETypeFromFilename in BZFoursquareRequest.o "_kUTTagClassFilenameExtension", referenced from: __BZGetMIMETypeFromFilename in BZFoursquareRequest.o "_kUTTagClassMIMEType", referenced from: __BZGetMIMETypeFromFilename in BZFoursquareRequest.o

Build Errors

Implicit conversion of a non-Objective-C

Hi!

I have been trying to add this library to a project and faced the next problem when initializing the object:
self.foursquare = [[BZFoursquare alloc] initWithClientID:kClientID callbackURL:kCallbackURL];

This is the bug that pops up: "Implicit conversion of a non-Objective-C pointer type char* to NSString is disallowed with ARC".

Has anyone faced a similar problem? I have been trying so solve with without no success.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.