我遇到了问题。 我有下面的代码保存文件上的数据。 我在设备上构建我的应用程序,然后运行。 结果变量为TRUE,但我没有在我的iPhone设备上找到该文件。 你能帮我吗? 感谢和抱歉,我的英语水平XP寻找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];
}
[saveToFile问题]的可能重复(http://stackoverflow.com/questions/2934368/problem-with-savetofile) – kennytm 2010-05-29 09:17:02
这是一个不同的问题。 – zp26 2010-05-29 09:21:59