J'ai un problème. J'ai le code ci-dessous pour enregistrer une donnée dans un fichier. Je construis mon application sur l'appareil et je cours. La variable de résultat est TRUE, mais je ne trouve pas le fichier sur le périphérique de mon iPhone. Pouvez-vous m'aider? Merci et désolé pour mon anglais XPVous cherchez le fichier journal sur iPhone
-(void)saveXML:(NSString*)name:(float)x:(float)y:(float)z{
NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
[archiver setOutputFormat:NSPropertyListXMLFormat_v1_0];
[archiver encodeFloat:x forKey:@"x"];
[archiver encodeFloat:y forKey:@"y"];
[archiver encodeFloat:z forKey:@"z"];
[archiver encodeObject:name forKey:@"name"];
[archiver finishEncoding];
NSString* filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"XML Position"];
BOOL result = [data writeToFile:filePath atomically:YES];
if(result)
[self updateTextView:@"success"];
[archiver release];
}
duplication possible de [Problème avec saveToFile] (http://stackoverflow.com/questions/2934368/problem-with-savetofile) – kennytm
C'est une question différente. – zp26