Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"IOException: Sharing violation on path" on building a Unity project on Mac OS X with Facebook Unity SDK 5.1

I get an "IOException: Sharing violation on path" after importing the Facebook Unity SDK.

The exception is thrown from FacebookPostprocess.cs:35, when the PostProcess tries to Save the modified Xcode project.

like image 222
Andrei Radulescu Avatar asked Dec 13 '25 00:12

Andrei Radulescu


1 Answers

It seems the modified version of XCodeEditor, the Facebook SDK uses, doesn't close the StreamReader.

You should change these lines in Assets\Facebook\Editor\iOS\third_party\XCodeEditor-for-Unity\XCProject.cs from:

projectFileInfo = new FileInfo( Path.Combine( this.filePath, "project.pbxproj" ) );
string contents = projectFileInfo.OpenText().ReadToEnd();

to:

projectFileInfo = new FileInfo( Path.Combine( this.filePath, "project.pbxproj" ) );
StreamReader sr = projectFileInfo.OpenText();
string contents = sr.ReadToEnd();
sr.Close();

The modification is from the original XCodeEditor (https://github.com/dcariola/XCodeEditor-for-Unity).

like image 99
Andrei Radulescu Avatar answered Dec 15 '25 17:12

Andrei Radulescu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!