Marco
Marco

Reputation: 33

Foursquare iOS API

I'm trying to figure out how to modify the Foursquare iOS API "BZFoursquare" found here: https://github.com/baztokyo/foursquare-ios-api. In their example they use an all-in-one ViewController. However I'll be having multiple ViewControllers and therefore want to have one AppController with the commonly used code. How do I need to do this under ios5?

Upvotes: 3

Views: 6264

Answers (2)

Emy
Emy

Reputation: 344

You can also use oAuth to login with foursquare, Because its really easy to implement. In oAuth 2.0 you have to get access token and using that access token you can get user details like friends and profile information. oAuth is 2 step verification method, To implement in detail, As you are newbie so I have found a nice tutorial for you, Login with Foursquare

Upvotes: 0

Raj Subbiah
Raj Subbiah

Reputation: 1292

see this link https://github.com/Constantine-Fry/Foursquare-API-v2/tree/master/Foursquare2-iOS . It's easy to integrate the foursquare API for iPhone.

Hi Marco, Add the Foursquare2 folder into your project and check the authentication in your view controller. See the following code. it will be help you.

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.title = @"Foursquare";
    //check the authentication
    if ([Foursquare2 isNeedToAuthorize]) {
       //If needed show the webview 
        webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
        NSString *url = [NSString stringWithFormat:@"https://foursquare.com/oauth2/authenticate?display=touch&client_id=%@&response_type=code&redirect_uri=%@",OAUTH_KEY,REDIRECT_URL];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
        [webView loadRequest:request];
        [webView setDelegate:self];
        [self.view addSubview:webView];
        [webView release];
        mTableView.hidden = YES;
    }else{
        //Show your view
        mTableView.hidden = NO;
        [Foursquare2 searchVenuesNearByLatitude:@"40.763" longitude:@"-73.990" accuracyLL:nil altitude:nil accuracyAlt:nil query:@"" limit:@"15" intent:@"" callback:^(BOOL success, id result){
            if (success) {

                tableData = [[FoursquareParser parseSearchVenuesResultsDictionary:(NSDictionary*)result] retain];
                [mTableView reloadData];

            }
        }];

    }
}

Upvotes: 4

Related Questions