I have a library I made, and now I want to utilize it in an application. I’ve believe I’ve properly linked to the library. Here are all the things I’ve done:
- Set the header search path
- Set other linker flags to “-ObjC”
- Added the static library xcode project
- Made sure the lib.a was listed as a framework target
- Added the library as a direct dependency
Like I said in the title, I’ve successfully run the app with the static library in the simulator. Once I try testing the app using the device, it crashes the second it has to use a function from the library:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSDate firstOfCurrentMonth]: unrecognized selector sent to class 0x3841bb44'
2009-10-10 12:45:31.159 Basement[2372:207] Stack:
This is due to a bug in the current SDK linker. See this post for more information on the problem and possible workarounds. (also see this post.)
Update:
Another thing you can try is to remove the static library and include the library’s source files directly in the application’s project. I was facing a similar static library linking issue and that’s what I ended up falling back on to get it to run successfully. If that works (however gross a workaround it may be) then it’s definitely a linker issue.