Search code examples
iosobjective-cxcodejavascriptcore

JavaScriptCore Mach-O Linker error, Xcode 6.2


I need to use the JavaScriptCore to call JS functions from my watch application but I cannot properly use the framework because I get this error as soon as I try to use it:

Undefined symbols for architecture i386: "_OBJC_CLASS_$_JSContext", referenced from: objc-class-ref in AppDelegate.o

I tried a compiled from Ejecta project:

https://github.com/phoboslab/Ejecta/tree/master/Source/lib

Didn't work. And I cannot compile from those Ejecta's binaries. I'm downloading lastest Xcode 6.2 beta 5 while I write in case I messed up with Xcode. I added libicucore and libstdc++ libraries to my project as well as the JavaScriptCore compiled framework. Also I set to "No" the "Build Active Architectures only".


Solution

  • Ejecta's build of JavaScriptCore doesn't feature the new Objective-C API - that's why the linker cannot find JSContext. I'm afraid that if you can't use the version of JavaScriptCore introduced in iOS 7 you are out of luck. You can't even build JavaScriptCore on your own with the JSContext API because its implementation relies on access to a couple of private functions in libobjc and this may cause your app to fail the App Store approval process.