Cloudrail - IOS

Bu bölüm, CloudRail'in iOS SDK'sının nasıl kullanılacağına dair bir giriş sağlar.

Kurmak

Yüklemenin en kolay yolu, CocoaPods. Aşağıdakileri eklemeniz yeterlidir:podfile -

pod "cloudrail-si-ios-sdk"

"Use_frameworks!" bayrak ayarlandı ve çalıştırıldı

Pod install

Kullanım

Aşağıdaki örnekler, Objective-C ve Swift'deki herhangi bir bulut depolama sağlayıcısından bir dosyanın nasıl indirileceğini gösterir.

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