このtutorialは、より多くの助けを借り、その後、それをやりました。 。.kmlファイルのファイル生成するためのコード:その後、
NSFileManager *filemgr;
NSData *databuffer;
NSString *dataFile;
NSString *docsDir;
NSArray *dirPaths;
filemgr = [NSFileManager defaultManager];
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
dataFile = [docsDir stringByAppendingPathComponent: @"datafile.kml"];
databuffer = [[xmlWriter toString] dataUsingEncoding: NSASCIIStringEncoding];
[filemgr createFileAtPath: dataFile contents: databuffer attributes:nil];
はそれを取得するためには、私が使用:
NSFileManager *filemgr;
NSString *dataFile;
NSData *databuffer;
NSString *docsDir;
NSArray *dirPaths;
filemgr = [NSFileManager defaultManager];
// Identify the documents directory
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
// Build the path to the data file
dataFile = [docsDir stringByAppendingPathComponent: @"datafile.kml"];
databuffer = [filemgr contentsAtPath: dataFile];
私はメートルによ私はコードをテストする方法がなかったので、私に何か問題があるかどうか知らせてください。 – holographix
ええ、私は文字列内のすべての内容を持っています.. btwどのようにファイルを添付ファイルとして設定するのですか? ありがとうalot :) –
これは、使用している作曲家の種類によって異なります。これは一度だけ行ったので、あまり経験はありませんが、このスレッドを見てくださいhttp://stackoverflow.com/questions/5509618/sending-doc-file-as-an-attach-on-ipad。ここでは.docファイルを送信しますが、MIMEタイプを変更すると、kmlのトリックも実行できます。それが助けて欲しい! – holographix