[ObjC] – iCloud class helper

A simple file managment system, to read / write / load files across devices.

What you need:

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

How to use?

Import #import “.h” in your project.

Next, set your delegate, and your file .

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"];

Main screen

Main screen

Check for enabled
[[APCloudCore sharedCloud] isCloudEnabled];
Save a file
[[APCloudCore sharedCloud] saveData:yourData withName:yourFileName];

Saved delegate

Saved delegate

Load a file
[[APCloudCore sharedCloud] loadDataWithName:yourFileName];
Delete a file
[[APCloudCore sharedCloud] deleteFileWithName:yourFileName];
Load all cloud files
[[APCloudCore sharedCloud] loadAllFilesWithPrefix:yourPrefix];

iCloud file list

iCloud file list


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;


@implementation APTestStore

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  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” or “xx” are the prefixes of your files!

You can find project on githubhttps://github.com/elpsk/iCloud-Helper
Feel free to edit/optimize/make money.

Rounded buttons (APRoundedButton) are explained in the last post: http://www.albertopasca.it/whiletrue/2014/04/objc-uibutton-rounded-corner/

Have fun.

ref: albertopasca.it