Vinli Net SDK
访问 Vinli 服务的框架。
文档
http://cocoadocs.org/docsets/VinliNet
安装
使用 CocoaPods 安装
pod 'VinliNet'
手动安装,转到您项目的“通用”选项卡并添加 VinliSDK.framework 文件作为嵌入式二进制文件
OAuth 指南
实现 Vinli Auth 的示例项目 http://bit.ly/vl-ios-auth
使用
创建一个 VLLoginViewController 对象,并分配您的 Client ID 和 Redirect URI。
VLLoginViewController *viewController = [[VLLoginViewController alloc] init];
viewController.clientId = @"96e9f8e4-0cqq-4528-9040-956e9edz446a";
viewController.redirectUri = @"myApp://";
viewController.delegate = self;
然后呈现视图控制器。用户认证后,VLLoginViewController 会关闭自身并调用下面的函数
- (void) vlLoginViewController:(VLLoginViewController *)loginController didLoginWithSession:(VLSession *)session
用户一旦拥有有效的 VLSession,创建一个 VLService
VLService *vlService = [[VLService alloc] init];
[vlService useSession:session];
使用 VLService 与 Vinli 服务交互
[vlService getDevicesOnSuccess:^(VLDevicePager *devicePager, NSHTTPURLResponse *response) {
} onFailure:^(NSError *error, NSHTTPURLResponse *response, NSString *bodyString) {
}];