gooichi / foursquare-ios-api Goto Github PK
View Code? Open in Web Editor NEWFoursquare API v2 for iOS
License: BSD 2-Clause "Simplified" License
Foursquare API v2 for iOS
License: BSD 2-Clause "Simplified" License
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.
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
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;
}
I dont know what I
m doing wrong since I set myself as the delegate, and implement them ...
Thanks for any help !
It would be VERY nice to have api for userless requests. Like list of nearby venues.
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 ,
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.
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?
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?
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
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.
Foursquare recently launched native auth for iOS and it is now the preferred way to authenticate on iOS.
Would love to see this make it into this library or at least the sample app!
When trying to run FSQDemo, it cannot import the header file (missing).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.