测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可 | MIT |
发布最后发布 | 2015年4月 |
由 alexruperez 维护。
提供类似 Instagram 的建议完成的 Foursquare 搜索控制器。
要运行示例项目,首先要克隆仓库,然后在 Example 目录中运行 `pod install`。
调用 `+ (void)configureWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret redirectURI:(NSString *)redirectURI
`
[FSNetworkingSearchController configureWithClientID:@"YOUR_CLIENT_ID" clientSecret:@"YOUR_CLIENT_SECRET" redirectURI:@"YOUR_REDIRECT_URI"];
如果您需要登录以获取准确的结果,请调用 `+ (void)loginWithCompletion:(FSNSCAccessTokenBlock)completion
并在您的 `- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
中放入 `+ (BOOL)handleOpenURL:(NSURL *)handledURL
`。
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [FSNetworkingSearchController handleOpenURL:url];
}
[FSNetworkingSearchController loginWithCompletion:^(NSString *accessToken, NSError *error) {
NSLog(@"DO STUFF");
}];
如果尚未获取用户位置,FSNetworkingSearchController 会自动获取,只需在您的 plist 中放入 `NSLocationWhenInUseUsageDescription
` 键即可。但您可以通过使用方法 `+ (void)forceLocation:(CLLocation *)location
` 强制使用自定义的 CLLocation,例如,如果您想使用图像的元数据。
将其用作您的 UISearchDisplayController 代理、UISearchController 搜索结果更新器或您的 UITableView 数据源和委托。您可以是程序性地实现或像示例项目那样使用 Storyboard。具有 IBInspectable 属性。
您可以自定义它或设置 selectHandler 来检测选定的 Foursquare 场所。
我使用 foursquare/FSNetworking 来进行 API 请求,但它是一个协议,您可以将其注入 FSNetworkingSearchController 或根据需要对其进行模拟。
向作者发送推文 @alexruperez,并查看 alexruperez 的博客:http://alexruperez.com
FSNetworkingSearchController 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。