Code Monkey home page Code Monkey logo

foursquare-api-v2's People

Contributors

gragera avatar imownbey avatar inquire avatar jdeokule avatar jonathanramirez avatar jordanbrown avatar jpstuehler avatar lmjabreu avatar lschwe avatar markdorison avatar mmobarak avatar mrcloud avatar mzsanford avatar natashatherobot avatar pbrewczynski avatar rodericj avatar sternhenri avatar wdn 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

foursquare-api-v2's Issues

open the authorization webView from a ModalView

I think that sometimes it could be useful opening the authorization webView from a login modalView. Currently, we just can't do it ("Attempt to present ----- on ----- whose view is not in the window hierarchy").

I'd suggest to add a patch that resolve this issue. Something like this one:

+(void)authorizeWithCallback:(Foursquare2Callback)callback{
    authorizeCallbackDelegate = [callback copy];
    NSString *url = [NSString stringWithFormat:@"https://foursquare.com/oauth2/authenticate?client_id=%@&response_type=token&redirect_uri=%@",OAUTH_KEY,REDIRECT_URL];
    FSWebLogin *loginCon = [[FSWebLogin alloc] initWithUrl:url];
    loginCon.delegate = self;
    loginCon.selector = @selector(done:);
    UINavigationController *navCon = [[UINavigationController alloc]initWithRootViewController:loginCon];
    navCon.navigationBar.tintColor = [UIColor lightGrayColor];
    UIWindow *mainWindow = [[UIApplication sharedApplication]keyWindow];
    UIViewController *topView = [self topViewController:mainWindow.rootViewController];
    [topView presentViewController:navCon animated:YES completion:nil];

}

+ (UIViewController *)topViewController:(UIViewController *)rootViewController
{
    if (rootViewController.presentedViewController == nil) {
        return rootViewController;
    }

    if ([rootViewController.presentedViewController isMemberOfClass:[UINavigationController class]]) {
        UINavigationController *navigationController = (UINavigationController *)rootViewController.presentedViewController;
        UIViewController *lastViewController = [[navigationController viewControllers] lastObject];
        return [self topViewController:lastViewController];
    }

    UIViewController *presentedViewController = (UIViewController *)rootViewController.presentedViewController;
    return [self topViewController:presentedViewController];
}

Thanks!
Filippo

Callbacks seg fault if they do anything other than NSLog

While I'm familiar with blocks / closures in other languages, I'm new to blocks in objective-c and am having trouble modifying the example callback blocks to do much of anything other than call NSLog :/

For instance, replacing

callback:^(BOOL success, id result){
  if (success) {
    NSLog(@"%@",result);
  }
}];

with code that tries to call an instance method or updates NSUserDefaults fails before the callback eever gets executed.

Any advice or help would be appreciated. TJust trying to do something meaningful upon login.

thnx,
mattpaul

Some request go to "The request timed out."

In my application I have after some days that the user logged in the message "The request timed out." for the Foursquare request. This problema cause the block of UI for the timeoutInterval (30sec).

I can not figure out if the problem can be the session token expired. Is possible to check if the token is still valid? ([Foursquare2 isAuthorized] return always YES). I need to refresh the token every time the app is launched? Other explanations?

Why not use "response_type=token"?

This code uses "response_type=code" when authenticating and uses some clever but unnecessary work to get the token.

Why not use "response_type=token"? And disadvantages?

How to access checkin screen?

Hi,

I'm using Foursquare's API to get nearest locations around a user. But I'm not using Foursquare's authentification system whatsoever, it's just about getting the location, presenting them to the user and picking one.

So basically I'd love to be able to call this view:

In the middle of my app, and get the result of what the user selected.

I was wondering, what are the steps I should take to get to that view? Is it even possible to use it without asking the user to auth with Foursquare?

Thanks and have a nice day

Cocoapods bug

When using the following pod declaration:

platform :ios, '7.0'

pod 'Foursquare-API-v2'

Files from the FSOAuth submodule get included in the pod, resulting in compilation errors, because it includes the FSOExample files aswell (main.m, FSAppDelegate.m).

Also, when someone is using the FSOAuth cocoapod seperately the project will break aswell because of redeclarations.

Multi Endpoint

Dear Constantine,
First of all great work on the library its amazing.
I have a question so i wanted to run it by you. I'm looking into using the multi endpoint to explore venues with different queries inside my app. and i've noticed that it is not included in this library. are you planning on including it? if not. can you guide me on how to do the inclusion myself?
thanks man

setupFoursquareWithKey vs setupFoursquareWithClientId

just ran into a problem, I'm using cocoapods to install Foursquare-API-v2, and wherever cocoapods pulls the repository from it doesn't seem to have gotten the update that setupFoursquareWithKey changed names (which was hard to figure out as the root cause since the docs have been updated.) Just thought I'd let you know.

Cheers

Foursquare2-Mac

Hi,

I've tried using Foursquare2-Mac to get a simple app to print to NSLog the badges a users has, or at least the checkin history but i have not been able to get it running. Is there any way you can post a wiki page on how to setup the Foursquare2-Mac?

Thanks!

iOS demo not working?

I created a new app in foursquare dev panel, and I changed the secrete id and key in the demo app. When I try to run the app nothing happens, if I try to search I get the following error:

2014-10-31 19:52:47.192 Foursquare2[454:36211] Error Domain=kFoursquare2ErrorDomain Code=400 "Must provide parameter ll" UserInfo=0x1748795c0 {NSLocalizedDescription=Must provide parameter ll}

I don't see anything on the map. It's something related to the location, because the longitude and latitude are both 0 or it's an issue related to authentication.

Any clue?

blank FSWebLogin

Hi there, when I make this call:

- (IBAction)foursquareAuthButton:(id)sender {
    [Foursquare2 authorizeWithCallback:^(BOOL success, id result){
        if (success) {
            NSLog(@"BOOM");   
        } else {
            NSLog(@"NOPE");
        }
    }];
}

what I assume should be a UIWebView with a navbar appears, but only the navbar is visible. The rest of the screen is black.

iOS Simulator Screen shot Apr 13 2013 1 09 32 AM

EXEC_BAD_ACCESS in connectionDidFinishLoading

I have EXEC_BAD_ACCESS in

  • (void)restConnection:(NSURLConnection *)connection
    didReturnResource:(id)resource
    object:(id)object
    {
    // NSUInteger code = [response statusCode];
    // BOOL success = (code >= 200 && code <= 299);

    Foursquare2Callback callback = (Foursquare2Callback)object;
    callback(YES, resource); <---------------- EXEC_BAD_ACCESS
    [callback release];
    }
    and deeper in the call stack

  • (void)connectionDidFinishLoading:(NSURLConnection *)connection
    .............
    [_delegate performSelectorOnMainThread:@selector(restConnection:didReturnResource:object:) withObjects:connection, results, _object, nil]; <---------------- EXEC_BAD_ACCESS
    ..............

That's all after logging in.

[Feature Request/Bug] Better error handling when there's no internet

For example, when I try to checkin using the following method:

[Foursquare2 createCheckinAtVenue:currentVenue.venueId
venue:currentVenue.name 
shout:[_checkinTextView string] 
broadcast:broadcastPublic
latitude:[NSString stringWithFormat:@"%f", currentVenue.latLong.coordinate.latitude] 
longitude:[NSString stringWithFormat:@"%f", currentVenue.latLong.coordinate.longitude]
accuracyLL:@"0" 
altitude:@"0" 
accuracyAlt:@"0" 
callback:^(BOOL success, id result){
        if (success){
            NSLog(@"%@",result);

        }else{
            NSLog(@"Checkin Error");
        }
}];

and if I don't have internet at the time I call the method, nothing happens.

Expected behavior:

  • callback is triggered, the value of success is NO and Checkin Error should appear on the console.

It would be very handy if there was a better "no internet" error handling. Thank you!

Error type deprecated in search for Venues near by LL

Asking for searchVenuesNearByLatitude: ... etc the response gives me an error:
{
"code":200,
"errorType":"deprecated",
"errorDetail":"This endpoint will stop returning groups in the future. Please use a current version, see http://bit.ly/lZx3NU."
}
The URL links to the versioning topics of the overview developer page of 4sq.

Regards,
Andrea

Crash when authorizing

Stack:

2011-05-28 14:34:18.471 Foursquare2-iOS[11535:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[**NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: access_token)'
* Call stack at first throw:
(
0 CoreFoundation 0x00f195a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0106d313 objc_exception_throw + 44
2 CoreFoundation 0x00ed1ef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00ed1e6a +[NSException raise:format:] + 58
4 CoreFoundation 0x00f17e15 -[__NSCFDictionary setObject:forKey:] + 293
5 Foursquare2-iOS 0x000074c3 +[Foursquare2 setAccessToken:] + 76
6 Foursquare2-iOS 0x00003044 __-[Foursquare_APIAppDelegate setCode:]_block_invoke_1 + 175
7 Foursquare2-iOS 0x00009f64 +[Foursquare2 restConnection:didReturnResource:object:] + 50
8 CoreFoundation 0x00e89c7d _invoking
+ 29
9 CoreFoundation 0x00e89b51 -[NSInvocation invoke] + 145
10 Foundation 0x00187efc -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 229
11 Foundation 0x0019a506 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 184
12 Foursquare2-iOS 0x0000b122 -[NSObject(InvocationUtils) performSelectorOnMainThread:withObjectArray:] + 323
13 Foursquare2-iOS 0x0000afc1 -[NSObject(InvocationUtils) performSelectorOnMainThread:withObjects:] + 202
14 Foursquare2-iOS 0x0000c314 -[HRRequestOperation connectionDidFinishLoading:] + 656
15 Foundation 0x001ab112 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
16 Foundation 0x001ab06b _NSURLConnectionDidFinishLoading + 133
17 CFNetwork 0x013ff492 _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 220
18 CFNetwork 0x014ca6e1 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 293
19 CFNetwork 0x014ca9cf _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1043
20 CFNetwork 0x013f5c84 _ZN19URLConnectionClient13processEventsEv + 100
21 CFNetwork 0x013f5ad3 _ZN17MultiplexerSource7performEv + 251
22 CoreFoundation 0x00efa8ff CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15
23 CoreFoundation 0x00e5888b __CFRunLoopDoSources0 + 571
24 CoreFoundation 0x00e57d86 __CFRunLoopRun + 470
25 CoreFoundation 0x00e57840 CFRunLoopRunSpecific + 208
26 CoreFoundation 0x00e57761 CFRunLoopRunInMode + 97
27 GraphicsServices 0x017501c4 GSEventRunModal + 217
28 GraphicsServices 0x01750289 GSEventRun + 115
29 UIKit 0x00417c93 UIApplicationMain + 1160
30 Foursquare2-iOS 0x000027d4 main + 106
31 Foursquare2-iOS 0x00002761 start + 53
)

terminate called after throwing an instance of 'NSException'

Dictionary with resources:

Printing description of resource:
<CFBasicHash 0x60585f0 [0xf86400]>{type = mutable dict, count = 1,
entries =>
11 : <CFString 0x6058340 [0xf86400]>{contents = "error"} = <CFString 0x6058430 [0xf86400]>{contents = "redirect_uri_mismatch"}
}


I have just register new app and set own key and secret.

Submodule issue

Cloning into the submodule isn't working

$ git submodule init
Submodule 'Foursquare2/submodule/foursquare-ios-oauth' ([email protected]:Constantine-Fry/foursquare-ios-oauth.git) registered for path 'Foursquare2/submodule/foursquare-ios-oauth'

$ git submodule update
Cloning into 'Foursquare2/submodule/foursquare-ios-oauth'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

No ability to get auth token

There is a plenty of apps that need foursquare auth token (for example I need to pass it to server in order to make friends check). There is no option to get access token from Foursquare2 class.

I have added a fix in my code.

+ (NSString *)accessToken{
    NSUserDefaults *usDef = [NSUserDefaults standardUserDefaults];
    return [usDef objectForKey:@"FOURSQUARE_ACCESS_TOKEN"];
}

It would be great to have a direct access to some kind of method handling this.

Strange behavior in nativeAuthorization

After the execution of
[sharedApplication openURL:authURL];
in FSOAuthNoAppStore and returns Foursquare app opened and nothing happens, but I suppose redirect to your test app.
In the case when Foursquare application has already been opened on device it's woks fine.

CocoaPods only for iOS?

CocoaPods has been supporting Mac apps for quite some time now. Would it be possible to update the podspec so that it can also be integrated into a Mac app?

I tried at klaustopher@66f9566c1d1b2448d399b1c463cc26dee2848650 but FSOAuth is relying on iOS... I'll look into this later, if it's possible to have a dependency for only one platform.

New cocoapods release

Hello!

In the latest version from cocoapods (1.3.1) addVenueWithName: suddenly changed so the latitude and longitude are NSStrings instead NSNumber like in all other APIs. I first thought I'd report an issue on this, but it seems like it's fixed on master. It would be great to see an updated cocoapods release for this!

Also, any plans to have a version changes-list so one can know what changes between the updates?

Thanks a lot!

No way to disable AppStore redirection in native authentication

When performing native authentication through Foursquare2 class if there is no Foursquare app installed it sends user to AppStore instead of simply showing auth web view.
I think it is a very common case when developer needs to show webview if there is no other option. Please, make it possible to control this.

Cocoapods version

The cocoapods version of this project is at version 0.0.1, but the repository has tags up to 1.1.2 at the time of writing this issue.

Is it possible to push these newer versions to cocoapods?

Invalid photo format

When using the "addPhoto:forCheckin:" method and passing in a regular UIImage, I get the following error back: "Invalid photo format: Invalid mime type: application/octet-stream"

OS X Podspec?

I see you have some code for OS X as well but I couldn't see it on cocoapods.org for OS X. Is it possible to port this API library to OS X with just some podspec changes?

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.