- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我是新手,正在尝试弄清楚如何修改此处找到的 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/
按照此处“https://developer.foursquare.com/overview/auth”的建议,我在 Web View 中获取访问 token ,然后在获取访问 token 后关闭浏览
我是新手,正在尝试弄清楚如何修改此处找到的 Foursquare iOS API“BZFoursquare”:https://github.com/baztokyo/foursquare-ios-ap
直到今天我一直在使用的代码,在我没有做任何事情的情况下开始失败。我收到了 401 错误代码。可能是什么问题? Fatal error: Uncaught exception 'EpiFoursquar
我是一名优秀的程序员,十分优秀!