Dropbox restClient enregistre uniquement les fichiers. Donc, je veux d'abord enregistrer l'image dans le dossier local, puis de le télécharger, par conséquent, il enregistre le fichier, mais il est corrompu.Comment télécharger une image qui n'est pas enregistrée sur l'appareil dans le compte de dépôt (IOS)
NSString *localPath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"];
NSString *jpegFilePath = [NSString stringWithFormat:@"%@/test.jpeg",localPath];
NSData *data2 = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0f)];
[data2 writeToFile:jpegFilePath atomically:YES];
NSString *filename = @"test.jpeg";
NSString *destDir = @"/";
[[self restClient] uploadFile:filename toPath:destDir
withParentRev:nil fromPath:localPath];
Je suis un idiot, résolu
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0] stringByAppendingString:@"test.jpg"];
NSData * data = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0f)];
[data writeToFile:path atomically:YES];
[self.restClient uploadFile:@"test.jpg" toPath:@"/" withParentRev:nil fromPath:path];
Est-ce que le résultat est corrompu en tant que brisé avec la bonne taille ou la mauvaise taille ou vide ou ...? –
La taille est égale à: 1 012 octets, donc c'est faux –