Hello and welcome

to Intellicore’s blog where we will give you info on relevant topics in relation to IT. We see the blog as a joint effort and would love to hear what you would like us to feature (there’s no point in us writing a blog that’s not of interest and we’d hate to bore you…)

Compiling MonoTouch Application to Device Fails - Works on Simulator

This week I ran into a problem that prevented the application I had written in MonoTouch from com-piling successfully to the iPhone/iPad device.

I outlined the problem more thoroughly on StackOverflow:


As you can see my question received a couple of answers, none of which worked out for me (though entirely valid).

So after more problem solving I worked out the solution below:
I changed the lines that read:

fs = new FileStream(fileName, FileMode.Open);

to:

fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);

This fixed the problem because the default constructor asks for read/write access, which the applica-tions main bundle does not allow.  Therefore, by specifying read-only access, the file stream does not ask the main bundle for write access which allows the file stream to read in the data.  Simple when you know how, hope you found this helpful.



2 comments :