cloud e ios - codemotion2013 roma
DESCRIPTION
Talk su come integrare i migliori servizi di cloud nelle app per iOS: da iCloud a Dropbox, da GDrive a Amazon S3.TRANSCRIPT
![Page 2: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/2.jpg)
Chi Sono?Francesco Novelli
- iOS Developer- Web Developer- Autore di Programmare applicazioni
per iPhone ed iPad-Autore di Programamre applicazioni
per Mac OS X
[email protected] - Run Code
![Page 6: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/6.jpg)
Di cosa parliamo oggi?Francesco Novelli
- iCloud- DropBox- Google Drive- Amazon S3
[email protected] - Run Code
![Page 7: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/7.jpg)
iCloudFrancesco Novelli
- Caratteristiche principali- Come implementarlo in un App- Pro- Contro
[email protected] - Run Code
![Page 8: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/8.jpg)
iCloud – Caratteristiche principaliFrancesco Novelli
I numeri
- 250 milioni di utenti- 500 milioni di iOS Device attivi- 50% degli utenti usa iCloud
[email protected] - Run Code
![Page 9: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/9.jpg)
iCloud – Caratteristiche principaliFrancesco Novelli
- Sincronizzazione automatica- Implementazione nativa nell’OS- Risoluzione conflitti automatica- 5 GB di spazio gratuito- Disponibile per Mac OS X
[email protected] - Run Code
![Page 10: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/10.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
- Non necessita di framework- Certificati necessari- iCloud Storage- iCloud Key-Value Data Storage
[email protected] - Run Code
![Page 11: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/11.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
Certificati:Entitlement attivo nell’app
[email protected] - Run Code
![Page 12: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/12.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
Certificati:AppID in iOS Dev Portal
[email protected] - Run Code
![Page 13: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/13.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
Certificati:Provisioning Profile dedicato
[email protected] - Run Code
![Page 14: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/14.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
iCloud Data Storage:Archiviazione fileSalvataggio DatabaseSalvataggio CoreDataCondivisione file tra devices
[email protected] - Run Code
![Page 15: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/15.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
iCloud Data Storage:// Controllare che iCloud sia attivo
id currentToken = [[NSFileManager defaultManager]
ubiquityIdentityToken]; if (!currentToken) {
// Alert user}
[email protected] - Run Code
![Page 16: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/16.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
self.query = [[NSMetadataQuery alloc] init]; [self.query setSearchScopes:
[NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]];
NSPredicate *pred = [NSPredicate
predicateWithFormat:@"%K like 'Note_*'", NSMetadataItemFSNameKey];
[self.query setPredicate:pred];
[email protected] - Run Code
![Page 17: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/17.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
for (NSMetadataItem *item in [query results]) { NSURL *url = [item valueForAttribute:NSMetadataItemURLKey]; Note *nota = [[Note alloc] initWithFileURL:url]; [nota openWithCompletionHandler:^(BOOL success) { if (success) { [self.notes addObject:nota]; } }]; }
[email protected] - Run Code
![Page 18: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/18.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
// CREARE UN FILE NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; NSURL *ubiquitousPackage = [[ubiq URLByAppendingPathComponent:@"Documents"]
URLByAppendingPathComponent:fileName]; Note *nota = [[Note alloc] initWithFileURL:ubiquitousPackage]; [nota saveToURL:[nota fileURL]
forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) {
if (success) { [self.notes addObject:nota]; [self.tableView reloadData]; } }];
];
[email protected] - Run Code
![Page 19: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/19.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
DA RICORDARE- NSFileManager per le operazioni
di I/O- NSMetadataQuery per la ricerca
dei file- I file vengono scaricati solo in caso
di necessità- Caricare solo le differenze!
[email protected] - Run Code
![Page 20: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/20.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
iCloud Key-Value StorageSalvataggio impostazioniSalvataggio stato dell’applicazioneSalvataggio piccoli dati
[email protected] - Run Code
![Page 21: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/21.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
Classi ammesse:• NSData• NSString• NSNumber• NSDate• NSArray• NSDictionary
[email protected] - Run Code
![Page 22: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/22.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
Scrivere un dato
[[NSUbiquitousKeyValueStore defaultStore]
setObject:@"testo" forKey:@"key"];
[email protected] - Run Code
![Page 23: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/23.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
Sincronizzare i dati
[[NSUbiquitousKeyValueStore defaultStore] synchronize];
[email protected] - Run Code
![Page 24: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/24.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
Leggere i dati
NSLog(@"%@",[[NSUbiquitousKeyValueStore defaultStore] objectForKey:@"key"]);
[email protected] - Run Code
![Page 25: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/25.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
NSUbiquitousKeyValueStore
==
NSUserDefaults
[email protected] - Run Code
![Page 26: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/26.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
PROProfondamente integrato con l’OSPoco codice e nessuna dipendenzaCompatibilità da iOS 5Compatibilità perfetta con OS X
[email protected] - Run Code
![Page 27: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/27.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
CONTRODisponibile SOLO con device
AppleSandbox impedisce spazio
condivisoL’utente non può accedere
direttamente ai file
[email protected] - Run Code
![Page 28: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/28.jpg)
DropboxFrancesco Novelli
- Caratteristiche principali- Come implementarlo in un App- Pro- Contro
[email protected] - Run Code
![Page 29: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/29.jpg)
Dropbox– Caratteristiche principaliFrancesco Novelli
- 100 milioni di utenti- Gratis fino a 16 Gb di spazio- LAN Sync- Condivisione cartelle tra utenti
[email protected] - Run Code
![Page 30: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/30.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
Registrazione nell’App Console:https://www.dropbox.com/developers/apps
- APP Type: API- APP Name Univoco- Access: App Folder
[email protected] - Run Code
![Page 31: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/31.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli [email protected] - Run Code
![Page 32: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/32.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli [email protected] - Run Code
App keyApp secret
![Page 33: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/33.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
Download Dropbox iOS SDKhttps://www.dropbox.com/developers/sync/tutorial/ios
Dropbox.framework in Xcode
[email protected] - Run Code
![Page 34: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/34.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
Altri framework necessari:• CFNetwork.framework• Security.framework• SystemConfiguration.framework• QuartzCore.framework
[email protected] - Run Code
![Page 35: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/35.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
#import <Dropbox/Dropbox.h>
- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opts { ... // The account manager stores all the account info. Create this when your app launches DBAccountManager* accountMgr = [[DBAccountManager alloc] initWithAppKey:@"APP_KEY" secret:@"APP_SECRET"]; [DBAccountManager setSharedManager:accountMgr]; DBAccount *account = accountMgr.linkedAccount; if (account) { DBFilesystem *filesystem = [[DBFilesystem alloc] initWithAccount:account]; [DBFilesystem setSharedFilesystem:filesystem]; } ...}
[email protected] - Run Code
![Page 36: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/36.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
Info.plist
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>db-APP_KEY</string> </array> </dict> </array>
[email protected] - Run Code
![Page 37: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/37.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url sourceApplication:(NSString *)source annotation:(id)annotation { DBAccount *account = [[DBAccountManager sharedManager]
handleOpenURL:url]; if (account) { DBFilesystem *filesystem = [[DBFilesystem alloc]
initWithAccount:account]; [DBFilesystem setSharedFilesystem:filesystem]; NSLog(@"App linked successfully!"); return YES; } ...}
[email protected] - Run Code
![Page 38: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/38.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
// ELENCARE FILE
NSArray *contents = [[DBFilesystem sharedFilesystem] listFolder:[DBPath root]
error:nil];for (DBFileInfo *info in contents) { NSLog(@"%@", info.path);}
[email protected] - Run Code
![Page 39: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/39.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
// SCRIVERE UN FILE
DBPath *newPath = [[DBPath root] childPath:@"hello.txt"];DBFile *file = [[DBFilesystem sharedFilesystem] createFile:newPath error:nil];[file writeString:@"Hello World!" error:nil];
// LEGGERE UN FILE
DBPath *newPath = [[DBPath root] childPath:@"hello.txt"];DBFile *file = [[DBFilesystem sharedFilesystem] createFile:newPath error:nil];NSString *fileContent [file readString:@"Hello World!" error:nil];
[email protected] - Run Code
![Page 40: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/40.jpg)
Dropbox– Come implementarlo in un AppFrancesco Novelli
// CONTROLLARE LE MODIFICHE
DBPath *path = [[DBPath root] childPath:@"change-me.txt"];
self.file = [[DBFilesystem sharedFilesystem] createFile:path error:nil]; // Next, register for changes on that file [self.file addObserver:self block:^() { // This block will be called every time your file changes // if newerStatus is not nil, it means a newer version is available DBFileStatus *newerStatus = file.newerStatus; if (newerStatus) { if (!newerStatus.cached) { NSLog(@"newerStatus.cached == NO; this means the file downloading"); } else { // Update to the newly available version and print it out [file update:nil]; NSLog(@"The file is done downloading: %@", [file readString:nil]); } } }];
[email protected] - Run Code
![Page 41: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/41.jpg)
Dropbox - PROFrancesco Novelli
PRODisponibile su tutte le piattaformeFile accessibili da qualsiasi appPossibilità di ampliare lo spazio
gratuitamente
[email protected] - Run Code
![Page 42: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/42.jpg)
Dropbox - CONTROFrancesco Novelli
CONTRONecessità di diverse dipendenzeCodice più complesso di iCloud
[email protected] - Run Code
![Page 43: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/43.jpg)
Google DriveFrancesco Novelli
- Caratteristiche principali- Come implementarlo in un App- Pro- Contro
[email protected] - Run Code
![Page 44: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/44.jpg)
Google DriveFrancesco Novelli
- TUTTI hanno un account Google- Integrato benissimo con Android..- …ed ha le API per iOS
[email protected] - Run Code
![Page 45: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/45.jpg)
Google DriveFrancesco Novelli
- Registrare l’app nel Google API Console: https://code.google.com/apis/console/
- Importare svariati framework- Importare i framework di Google
Drive
OPPURE
[email protected] - Run Code
![Page 46: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/46.jpg)
Google DriveFrancesco Novelli
Seguire alla lettera le istruzioni di questa pagina:
https://developers.google.com/drive/quickstart-
ios
(non il video, l’app non compila!)
[email protected] - Run Code
![Page 47: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/47.jpg)
Google DriveFrancesco Novelli
GTLDriveFile *file = [GTLDriveFile object]; file.title = [dateFormat stringFromDate:[NSDate date]]; file.descriptionProperty = @”Desc"; file.mimeType = @"image/png"; NSData *data = …; // DATA TO UPLOAD GTLUploadParameters *uploadParameters = [GTLUploadParameters
uploadParametersWithData:data MIMEType:file.mimeType];
GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:file uploadParameters:uploadParameters];
[email protected] - Run Code
![Page 48: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/48.jpg)
Google DriveFrancesco Novelli
[self.driveService executeQuery:querycompletionHandler:^(GTLServiceTicket *ticket,
GTLDriveFile *insertedFile,NSError
*error) { if (error == nil)
{ NSLog(@"File ID: %@", insertedFile.identifier);
}}];
[email protected] - Run Code
![Page 49: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/49.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
PROTutti hanno un account GoogleDisponibile in tutte le piattaforme€/Gb più basso della concorrenza
[email protected] - Run Code
![Page 50: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/50.jpg)
iCloud – Come implementarlo in un AppFrancesco Novelli
CONTROTANTE dipendenzeCodice complessoLive Sync non disponibile
[email protected] - Run Code
![Page 51: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/51.jpg)
Amazon S3Francesco Novelli
- Caratteristiche principali- Come implementarlo in un App- Pro- Contro
[email protected] - Run Code
![Page 52: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/52.jpg)
Amazon S3Francesco Novelli
- Spazio dello sviluppatore- L’utente non ha bisogno di un
account- Servizio totalmente differente dagli
altri- Supporto a CoreData
[email protected] - Run Code
![Page 53: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/53.jpg)
Amazon S3Francesco Novelli
- Scaricare l’SDK dal sito AWS:
http://aws.amazon.com/sdkforios/
- Importare AWSiOSSDK.framework nel progetto
[email protected] - Run Code
![Page 54: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/54.jpg)
Amazon S3Francesco Novelli
AWSPersistence.framework
CoreData tramite S3, ma ancora in beta
[email protected] - Run Code
![Page 55: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/55.jpg)
Amazon S3Francesco Novelli
self.s3 = [[[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY] autorelease];
self.s3.endpoint = [AmazonEndpoints s3Endpoint:US_WEST_2];
S3CreateBucketRequest *createBucketRequest = [[[S3CreateBucketRequest alloc] initWithName:[Constants pictureBucket] andRegion:[S3Region USWest2]] autorelease];
S3CreateBucketResponse *createBucketResponse = [self.s3 createBucket:createBucketRequest];
if(createBucketResponse.error != nil) { NSLog(@"Error: %@", createBucketResponse.error); }
[email protected] - Run Code
![Page 56: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/56.jpg)
Amazon S3Francesco Novelli
S3PutObjectRequest *por = [[[S3PutObjectRequest alloc] initWithKey:PICTURE_NAME
inBucket:[Constants pictureBucket]] autorelease];
por.contentType = @"image/jpeg"; por.data = imageData;
S3PutObjectResponse *putObjectResponse = [self.s3 putObject:por]; [self performSelectorOnMainThread:@selector(showCheckErrorMessage:) withObject:putObjectResponse.error waitUntilDone:NO];
[email protected] - Run Code
![Page 57: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/57.jpg)
Amazon S3Francesco Novelli
S3ResponseHeaderOverrides *override = [[[S3ResponseHeaderOverrides alloc] init] autorelease];
override.contentType = @"image/jpeg";
// Request a pre-signed URL to picture that has been uplaoded.S3GetPreSignedURLRequest *gpsur = [[[S3GetPreSignedURLRequest alloc] init] autorelease];gpsur.key = PICTURE_NAME;gpsur.bucket = [Constants pictureBucket];gpsur.expires = [NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval) 3600];gpsur.responseHeaderOverrides = override;
// Get the URLNSError *error;NSURL *url = [self.s3 getPreSignedURL:gpsur error:&error];
[email protected] - Run Code
![Page 58: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/58.jpg)
Amazon S3 – PROFrancesco Novelli
PROSpazio praticamente illimitatoSemplice implementazioneFile condivisi con tuttiL’utente non ha bisogno di un
account
[email protected] - Run Code
![Page 59: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/59.jpg)
Amazon S3 – CONTROFrancesco Novelli
CONTROLo spazio non è personalePer grandi progetti da valutare il
€/GbCosti per il trasferimento dei file
[email protected] - Run Code
![Page 61: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/61.jpg)
- iCloud per progetti iOS-Only (o Mac)- Dropbox per applicazioni su più OS- Google Drive come alternativa a
Dropbox- Amazon S3 per far caricare file
all’utente
In conclusioneFrancesco Novelli [email protected] - Run Code
![Page 62: Cloud e iOS - Codemotion2013 Roma](https://reader038.vdocuments.us/reader038/viewer/2022110119/555e9e56d8b42a0d738b59b6/html5/thumbnails/62.jpg)
Q&A Time…[email protected]
@iF9www.9lli.it/francesco
www.facebook.com/fnove
In conclusioneFrancesco Novelli [email protected] - Run Code