Application streamingAssetsPath iOS Write Error: UnauthorizedAccessException

I can read the file just fine, but when I write to it, I get this exception on iOS. Writing works in the unity editor though.
I’m using a StreamWriter to write a string to the file and on initialization, I set the file path attributes to normal like this, still getting the exception.

The file path is “Application.streamingAssetsPath + file_path”, and my file is in Assets/StreamingAssets/[file_path]

File.SetAttributes (FILE_PATH, FileAttributes.Normal);

StreamWriter w = new StreamWriter (file_path, false);
w.Write (contents);
w.Close ();

How can I get write access to this file on iOS? Or where can I get a consistent file path for all platforms where I can read/write?

Finally found this answer which helped me out.

So you can read from streaming assets but not write, so if you want to import data from Streaming Assets folder, then you need to read it, and write it to the PersistentDataPath folder and use it from then on out.

My solution uses the streaming assets path in editor, so any data written in editor mode is imported by all new builds.

Ended up with some logic like this that works.

#if UNITY_EDITOR
SAVE_FILE_PATH = Application.streamingAssetsPath + [file_path];
ImportHighScores();
#elif UNITY_IPHONE
SAVE_FILE_PATH = Application.persistentDataPath + [file_path];
if (!File.Exists (SAVE_FILE_PATH))
{
SAVE_FILE_PATH = Application.streamingAssetsPath + file_path;
ImportHighScores();

		SAVE_FILE_PATH = Application.persistentDataPath + file_path;

		UpdateSaveFile();//writes the file with high score data
	}
	else
	{
		ImportHighScores();
	}

#endif