Code Monkey home page Code Monkey logo

icloud-helper's Introduction

iCloud-Helper

Simple iCloud file managment.
Read, write, load, list files across devices, easily.

Before starting, please read Apple official reference: https://developer.apple.com/icloud/documentation/

##Requirements

  • A valid Provisioning Profile ( with iCloud access )
  • An iCloud account
  • iOS 5.1+
  • ARC
  • iOS device
  • Security.framework

##Configuration

Copy these files to your project:

APCloudCore.h
APCloudCore.m
APCloudDocument.h
APCloudDocument.m
APCloudFileSystem.h
APCloudFileSystem.m
APCloudData.h
APCloudData.m
NSString+MD5.h
NSString+MD5.m

and import Security.framework to your project.


###Screenshots

SS Screenshot SS Screenshot
SS Screenshot

##How to use

Import #import "APCloudCore.h" in your project.

Next, set your delegate, and your file prefix.
File prefix, is very important if you want to separate files, because iCloud don't permit to create and read folders.

Every classes provides a singleton access.

[[APCloudCore sharedCloud] setDelegate:self];
[[APCloudCore sharedCloud] setFilePrefix:@"ap"];

####Methods: ######Check for cloud enabled

[[APCloudCore sharedCloud] isCloudEnabled];

######Save a file

[[APCloudCore sharedCloud] saveData:yourData withName:yourFileName];

######Load a file

[[APCloudCore sharedCloud] loadDataWithName:yourFileName];

######Delete a file

[[APCloudCore sharedCloud] deleteFileWithName:yourFileName];

######Load all cloud files

[[APCloudCore sharedCloud] loadAllFilesWithPrefix:yourPrefix];

###APCloudCoreDelegate

If you're implemented the optionals delegate, you should implements the delegates (finish and fail):

- (void) apCloudCoreDidFinishUpdate;
- (void) apCloudCoreDidFailUpdate;

- (void) apCloudCoreDidFinishLoadFiles:(NSMutableArray*)file;
- (void) apCloudCoreDidFailLoadFiles;

- (void) apCloudCoreDidFinishSaveData:(id)data;
- (void) apCloudCoreDidFailSaveData:(id)data;

- (void) apCloudCoreDidFinishLoadData:(id)data;
- (void) apCloudCoreDidFailLoadData:(id)data;

- (void) apCloudCoreDidFinishDeleteData:(id)data;
- (void) apCloudCoreDidFailDeleteData:(id)data;

###Notes on SAVE Save method, accept an id as file. This id is your custom class, that must implements NSCoding protocol.

Example of test store class:

@interface APTestStore : NSObject <NSCoding>

@property (nonatomic, strong) NSString *aTitle;
@property (nonatomic, strong) NSString *aSubTitle;
@property (nonatomic, strong) NSString *aDescription;

@end

@implementation APTestStore
@end

This class is saved (encrypted) and loaded (decrypted) to/from cloud as NSData.

######Cloud files File are stored in your Cloud directory, that is accessibile from web, at url http://developer.icloud.com or in your Mac local folder, ~/Library/Mobile Documents/.

Files are stored using this tree:

~/Library/Mobile Documents/XXXXXXX~it~albertopasca~dev-app/Documents/

ap_test-file-1.dat
ap_test-file-2.dat
ap_test-file-3.dat
xx-afile-1.dat
xx-afile-2.dat
[...]

"ap" or "xx" are the prefixes of your files!

Have fun.

icloud-helper's People

Contributors

elpsk avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.