Ejemplo n.º 1
0
        public void WriteFile()
        {
            try
            {
                // Gets the direct path to the file
                NSString folderPath = dataPath.AppendPathComponent(new NSString("testfile.txt"));

                // The text who should be written
                NSString someText = new NSString("Test");

                // The data
                NSData data = someText.Encode(NSStringEncoding.UTF8);

                // Handle the data and writes it to the specific path
                NSFileHandle nsfh = NSFileHandle.OpenWrite(folderPath);

                // Writes the data
                nsfh.WriteData(data);
            }
            catch (Exception ex)
            {
                // Failed write data into a file
            }
        }