[TIMOB-18208] Writing a plugin that links to JavaScriptCore.framework produces a naming clash
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-02-18T18:03:38.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 4.0.0 |
Components | iOS |
Labels | appstore |
Reporter | Peter Steinberger |
Assignee | Jon Alter |
Created | 2014-12-14T15:31:49.000+0000 |
Updated | 2015-03-26T20:08:58.000+0000 |
Description
The Titanium framework uses a custom version of JavaScriptCore. If an app links to Apple's JavaScriptCore.framework that was introduce in iOS 7, Apple's App Store validator fails because it detects calls to WTFReportBacktrace and WTFReportFatalError which both are referenced inside libTiCore.a.
Attached various disassembly that shows the calls.
Apple most likely created a special rule so existing Titanium projects are not automatically rejected, but disables that rule if newer frameworks such as JavaScriptCore are used. Now we have an experimental version of our PSPDFKit plugin that works in the App Store, but we really need JSCore to have all of our features - we don't want to provide our customers with a crippled version just because of a naming clash in the Titanium framework.
The proper solution here would be to rename/prefix the internal Webkit-methods.
Attachments
[~steipete] You had mentioned you "surgically remov[ed] all parts that interact with Apples JavaScriptCore framework." Could you elaborate a bit on how you did that? Also, to confirm, you _can't_ use the version of JSCore that we ship--you need to use Apple's version?
Thanks for looking into this. For the current workaround I added
#if !defined(PSPDF_SKIP_JSCORE) || !PSPDF_SKIP_JSCORE
around all headers/implementations that access code interacting with JavaScriptCore, built a custom binary and then linked that binary to our Titanium Plugin (https://github.com/PSPDFKit/PSPDFKit-Titanium) We have a closed source framework and an open source Titanium Plugin that uses this closed source binary. Using the Titanium JavaScriptCore would be really hard, we would need to change the structure and built a separate binary that links to Appcelerator's JSCore (and giving up the open source plugin). That wouldn't be a feasible solution. Also, your version most likely differs from Apple's version, creating a whole new set of Titanium-specific bugs or different behaviors.Hi Peter, we are using in 3.5.0 the tagged version 538.11.1 directly from the WebKit repo (the 3.4.1 version is an earlier version). Either way, there should not be any Titanium-specific bugs. However, I do see how you would be reluctant to build a Titanium-specific version because it would alter your build process. Are you using the Objective C or C-based API to JSCore?
We're using the Objective-C based API. Our main focus is on the PSPDFKit binary, which has no reference to Titanium. People take that closed source binary and use it to build our Titanium wrapper. Using your JSCore version would mean adding conditionals; a new set of tests; adding two more sets of binaries (since we already have a version with OpenSSL and one without; so now we'd have 4 different combinations). That's not feasible; if we have to choose we'd probably phase out Titanium support then (but I'd rather see this fixed in your platform - we won't be the last who will have a huge code base using all kind of frameworks including JavaScriptCore + a tiny wrapper to make it usable in Titanium.) What would be the downsides if you renaming the two symbols in question?
I noticed you started working on this - what direction are you going with fixing this? As we're working on our 4.2 release this would be good to know (including a time frame for the fix)
For the first version we are planning on doing additional name mangling. It may be that for the very first release we have a drop-in replacement for our for TiCore that affected customers can use. Longer-term we plan on allowing for the usage of the built-in JSCore which would eliminate that.
PRs TiJSCore: https://github.com/appcelerator/tijscore/pull/28 tidebugger: https://github.com/appcelerator/titanium_debugger/pull/30 titanium_mobile (updating debugger lib)(master): https://github.com/appcelerator/titanium_mobile/pull/6613 Need to update the built TiJSCore lib once these are merged
Updating Your SDK
TiSDK 3.5.0.GA can be updated to include this fix by downloading and updating the [libTiCore.a](https://dl.dropboxusercontent.com/u/7540194/TitaniumLibs/libTiCore.a) and [libti_ios_debugger.a](https://dl.dropboxusercontent.com/u/7540194/TitaniumLibs/libti_ios_debugger.a) libraries. Once downloaded, place these libraries in the *iphone* folder of your titanium sdk (overwriting the old libraries).Testing instructions
These steps are to be done after updating the titanium mobile sdk via the instructions above. 1. download and install the attached module "com.example.test-iphone-1.0.0.zip" 2. Create an app and include the module that you just installed in the tiapp.xml 3. Package the app for production 4. In the Xcode Organizer validate the app 5. The validation should pass When the same process is followed before the update, the following error was displayed when validating the app. !Screen Shot 2015-01-26 at 1.45.35 PM.png![~steipete] Would you be able to try updating your SDK as [~jalter] mentions and see if that addresses the issue?
New PR agains titanium_mobile master https://github.com/appcelerator/titanium_mobile/pull/6642
Verified fix using: Mac OSX 10.10.2 Titanium SDK build: 4.0.0.v20150325201813 Titanium CLI, build: 4.0.0-alpha Alloy: 1.6.0-alpha Xcode 6.2 Created a new app added the module and then packaged in Xcode, no errors were given when packaging. Closing ticket.