I have created a static library and built it for both Release-Simulator and Release-iPhoneOS. I have one class file in the library that adds two functions to the NSString interface. The function is called __IsURL. When I link to the static library and build and run for iPhone simulator, everything works fine but when I build the project and run it for iPhone OS, I get the below error:
Code:
2009-11-27 10:20:29.906 MyDummy[620:207] *** -[NSCFString __IsURL]: unrecognized selector sent to instance 0xd0a8
2009-11-27 10:20:29.914 MyDummy[620:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString __IsURL]: unrecognized selector sent to instance 0xd0a8'
Any idea what this is? Any help would be appreciated.
__________________ UK Flights
Latest UK Flight information right in your iPhone/iPod Touch. All major UK Airports are available in this brilliant iPhone Application. Download from the iTunes Store.
In fact, I just checked and any interface addition (even the pooular NSDataAdditions) causes this issue when it is inside a static library. You just can't use the code inside them. Any ideas?
__________________ UK Flights
Latest UK Flight information right in your iPhone/iPod Touch. All major UK Airports are available in this brilliant iPhone Application. Download from the iTunes Store.
Not 100% sure about this, but try adding -ObjC to the "other linker flags" entry in the build configuration. I _think_ it tells the linker to check for obj-c in linked files, but like I said, I'm not 100%... but, hey, it's worth a shot, right?
__________________ SimCap - Simple iPhone and iPad Simulator screen capture
Not 100% sure about this, but try adding -ObjC to the "other linker flags" entry in the build configuration. I _think_ it tells the linker to check for obj-c in linked files, but like I said, I'm not 100%... but, hey, it's worth a shot, right?
Hi, thanks for your help. I already had -ObjC added to Other Linker Flags. I fixed the issue though.
For anybody having the same problem, you have to add -all_load to linker flags as well. So add:
-ObjC
-all_load
This will make sure the extensions also get compiled into the code. These two have to be added to BOTH the static library and the project that uses the static library. VERY IMPORTANT they are added to both projects. Hope this helps somebody with the same problem.
__________________ UK Flights
Latest UK Flight information right in your iPhone/iPod Touch. All major UK Airports are available in this brilliant iPhone Application. Download from the iTunes Store.