Skip to content

Instantly share code, notes, and snippets.

View fel-cesar's full-sized avatar

Felipe Cesar fel-cesar

View GitHub Profile
#DONT PUSH PRODUCTS
Products/
Products/*
#Docs - Not uploading docs
docs/
docs/*
# COCOAPODS
@fel-cesar
fel-cesar / CRSwiftExample.swift
Created August 9, 2016 12:18
Example for cloudrail website
//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")
let cloudStorage : CloudStorageProtocol = Dropbox.init(clientId: "ClientID", clientSecret: "ClientSecret")
do{
let inputStream = try cloudStorage.createFolderWithPath("/My folder path")
} catch let error{
print("An error: \(error)")
}
######################
# Options
######################
REVEAL_ARCHIVE_IN_FINDER=false
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
//This is the set up code for iOS
//By replacing "CRDropbox" in the lines below you can implement whatever Cloud Storage service you want.
//Example:
//[CRBox alloc]
//[CROneDrive alloc], etc...
self.dropbox = [[CRDropbox alloc] initWithClientId:@"dropboxKey"
clientSecret:@"dropboxSecret"
redirectUri:@"https://www.cloudrailauth.com/auth" //example
state:@"CRSTATE"];// anyStateString will do for iOS
//Assuming already existing "@property (nonatomic) Dropbox* dropbox;"(DropBox,Box,,GoogleDrive,OneDrive...)
UIImage * image = imageSource;
NSData * pngImageData = UIImagePNGRepresentation(image); // loading data from some source. (PNG)
NSInputStream * inputStream = [NSInputStream inputStreamWithData:pngImageData];
[self.service uploadFileToPath:@"/mudkip.jpg" withStream:inputStream size:imageData.length overwrite:YES];