I want to use StorageFile, to implement Reading & Writing as seen here
http://msdn.microsoft.com/en-us/library/windows/apps/hh758325.aspx#writing_to_a_file
With
public async void Save()
{
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
StorageFile sampleFile = await storageFolder.CreateFileAsync(PlayerPrefs.GetString("WorldName") +"_"+filename);
await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow");
}
But the "await" line gives the exception
+ $exception {Cannot evaluate expression because a native frame is on top of the call stack.} System.Exception {System.UnauthorizedAccessException}
I'm using Unity with Windows 8 Store if this makes any difference.
Anyone know what the problem is here?
Cannot evaluate expression because a native frame is on top of the call stack
That only tells us that the thread is executing unmanaged code, hence it cannot evaluate the expression.
The real error is the System.UnauthorizedAccessException
.
So open your Package.appxmanifest, go to the Capabilities tab and check Document Library Access.