I have an external static library (I have the source code as well) that uses 'fopen' to access files on the filesystem. The strange thing is that it always fails both on simulator and device when it tries to do so with EXE_BAD_ACCESS
inside fopen$UNIX2003
(not in fopen
, fopen
is not even in the call stack when the exception is thrown. I've tried to use fopen
directly myself with the same path/options and it works. So, first of all, is it possible that the library is somehow calling a different fopen
implementation? If so, why, and most important how can I make it call the 'right' one?
EDIT: Actually, the last function in the call stack before the exception is thrown is _interposition_vtable_unimplemented
, fopen$UNIX2003
precedes it.
fopen$UNIX2003 is a symbol that is provided by OS X and is not part of the iOS Simulator runtime. iOS is always conformant and thus does not have legacy (non $UNIX2003) variants of functions (which are provided for binary compatibility with code built against older versions of the OS X SDK).
The common cause of the issue you are seeing is that you have an object file or archive (libsomething.a) that was built against the OS X SDK and are trying to link it into your iOS Simulator executable. That is not supported as the two platforms are not binary compatible at that layer.
You need to rebuild your library (the libsomething.a) against the iOS Simulator SDK.
This problem results in an abort at runtime on iOS 7 but is now a link error at build time on iOS 8, and that seems to have helped make these issues much more obvious.