i have the following Error when i am submitting the .ipa File with the Application Loader to Apple. I have builded the App with Visual Studio (C# / .NET) for Mac and Couchbase Mobile 2 (DB23). Has anyone ideas for a solution?
Thank you.
ERROR ITMS-90171: “Invalid Bundle Structure - The binary file ‘myapp.app/libLiteCore.dylib’ is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.”
ERROR ITMS-90209: “Invalid Segment Alignment. The app binary at ‘myapp.app/libLiteCore.dylib’ does not have proper segment alignment. Try rebuilding the app with the latest Xcode version.”
Wow, I don’t think you’ve done anything wrong…I think I just got caught utterly off guard. I was assuming (based on Xamarin documentation) that embedding a dynamic lib and referencing it was the correct solution to distribute libLiteCore.dylib (since it was working fine on both device and simulator) but apparently not. I will have to search for a new solution.
Yes, I understand the problem…it’s just annoying because the solution is to rearchitect one of the fundamental pillars of the library in order to comply with Apple’s arbitrary requirements. It is a total blindside.
It’s not going to be quick anywhere from a few days to a week…right now what happens is that the native dynamic library gets generated for all platforms, and so the P/Invoke methods are all defined using the name “LiteCore”. That is how it has been working so far, but now it needs to be repackaged as an iOS framework instead, and the name needs to be changed (which is ridiculously non-trivial for something that sounds so small). Here are the steps:
Repackage LiteCore as a framework instead of a dylib
Interface the entire LiteCore API (hundreds of methods)
Make two implementations of the P/Invoke bindings, one which points to the iOS dynamic library name (which becomes "@rpath/LiteCore.framework/LiteCore) and one for everything else that points to “LiteCore” (The string is required to be a compile time constant…)
Make two implementations of the interface which call the correct P/Invoke bindings
Register those at runtime depending on the OS
Pray Apple doesn’t become more annoying…I seriously cannot fathom the reason I can package an embedded framework, but not an embedded dylib
Have [either of] you asked on Xamarin forums about this? Seems like it would affect other developers using native libraries.
By Apple’s bundle docs, it’s never been kosher to just drop a dylib into the top level of the bundle; they just never enforced that until now, I suppose.
Is step 2 necessary? I assume it’s to generate a LiteCore.h header file … I don’t think that’s required in the bundle, or at least nothing will mind if it’s blank.
@jens That step is C#, as are all of them except for step 1. I was referring to interfacing the C# bindings. The headers are not necessary as C# looks up everything via dysym
I did ask on the Xamarin forums almost immediately (reference) but as usual with my questions there is nothing but silence.
I finally finished the work on refactoring this. I’m working on trying to validate it but I need to create distribution certs, etc, and I’m rusty on all that.
I tried with db023, and the newest internal build that uses LiteCore.framework instead of libLiteCore.dylib, and I saw the error in the archive validator that comes with Xcode for db023, but it is gone for the newer build.