gpt4 book ai didi

iphone - 四方 iOS API

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:51:32 26 4
gpt4 key购买 nike

我是新手,正在尝试弄清楚如何修改此处找到的 Foursquare iOS API“BZFoursquare”:https://github.com/baztokyo/foursquare-ios-api在他们的示例中,他们使用了一个一体化的 ViewController。但是,我将拥有多个 ViewController,因此希望拥有一个具有常用代码的 AppController。我需要如何在 ios5 下执行此操作?

感谢您的帮助。

最佳答案

请参阅此链接 https://github.com/Constantine-Fry/Foursquare-API-v2/tree/master/Foursquare2-iOS .很容易为 iPhone 集成 foursquare API。

嗨,马可,将 Foursquare2 文件夹添加到您的项目中,并在您的 View Controller 中检查身份验证。请参见以下代码。它会对你有所帮助。

- (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];

}
}];

}
}

关于iphone - 四方 iOS API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8886616/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com