Voici un extrait du code:Cocoa contentsOfDirectoryAtPath: méthode échoue avec erreur pour certains utilisateurs - Mac OS X
// Get into the data folder of it
keychainPath = [keychainPath stringByAppendingPathComponent:@"data/default"];
DLog(@"Keychain data path: %@", keychainPath);
// Define Filemanager
NSFileManager *fm = [NSFileManager defaultManager];
// Catch any errors
NSError *dataError = nil;
// get all the files in the directory
NSArray *dataFiles = [fm contentsOfDirectoryAtPath:keychainPath error:&dataError];
if(!dataFiles)
NSLog(@"Error: %@",dataError);
Maintenant, cela fonctionne parfaitement bien pour la plupart des gens, mais quelques-uns ont signalé des problèmes, avec le ' DataError » objet donnant:
Error: Error
Domain=NSCocoaErrorDomain Code=260 UserInfo=0x14d1fa10 "The folder
“default” doesn’t exist." Underlying Error=(Error
Domain=NSOSStatusErrorDomain Code=-43 "The operation couldn’t be
completed. (OSStatus error -43.)" (File not found))
les personnes ayant ce problème ont dit que le fichier/dossier « default »n'existe exactement où est devrait être, donc je ne sais pas pourquoi cela ne fonctionne pas.
Toute aide serait appréciée!
Alors, quelle est la valeur de 'keychainPath'? 'KeychainPath' est-il une variable d'instance ou une variable locale? Ce code peut-il être exécuté deux fois pour la même instance? –