- Cloudrail 教程
- Cloudrail - 主页
- Cloudrail - 概述
- Cloudrail - Android
- Cloudrail - Java
- Cloudrail - Node.js
- Cloudrail - iOS
- Cloudrail - 社交登录
- Cloudrail - 设置
- Cloudrail - 编码
- Cloudrail 有用资源
- Cloudrail - 快速入门
- Cloudrail - 有用资源
- Cloudrail - 讨论
Cloudrail - iOS
本部分介绍如何在 iOS SDK 中使用 CloudRail。
设置
安装最简单的方法是通过 CocoaPods。只需将以下内容添加到你的 podfile 中即可 −
pod "cloudrail-si-ios-sdk"
确保已设置“use_frameworks!”标志并运行
Pod install
用法
以下是使用 Objective-C 和 Swift 从任何云存储提供商下载文件的一些示例。
objective-c // self.service = [[CROneDrive alloc] initWithClientId:@"clientIdentifier" clientSecret:@"clientSecret" redirectUri:@"REDIRURL" state:@"CRSTATE"]; // self.service = [[CRGoogleDrive alloc] initWithClientId:@"clientIdentifier" clientSecret:@"clientSecret" redirectUri:@"REDIRURL" state:@"CRSTATE"]; // self.service = [[CRBox alloc] initWithClientId:@"clientIdentifier" clientSecret:@"clientSecret" redirectUri:@"REDIRURL" state:@"CRSTATE"]; [CRCloudRail setAppKey:@"CLOUDRAIL_API_KEY"]; self.service = [[CRDropbox alloc] initWithClientId:@"clientIdentifier" clientSecret:@"clientSecret" redirectUri:@"REDIRURL" state:@"CRSTATE"]; NSInputStream * object = [self.service downloadFileWithPath:@"/mudkip.jpg"]; //READ FROM STREAM swift //let cloudStorage : CloudStorageProtocol = Box.init(clientId: "ClientID", clientSecret: "ClientSecret") //let cloudStorage : CloudStorageProtocol = GoogleDrive.init(clientId: "ClientID", clientSecret: "ClientSecret") //let cloudStorage : CloudStorageProtocol = OneDrive.init(clientId: "ClientID", clientSecret: "ClientSecret") CRCloudRail.setAppKey("CLOUDRAIL_API_KEY") let cloudStorage : CloudStorageProtocol = Dropbox.init( clientId: "ClientID", clientSecret: "ClientSecret") do { let inputStream = try cloudStorage.downloadFileWithPath("/TestFolder/Data.csv") } catch let error{ print("An error: \(error)") } //READ FROM STREAM
广告