Search code examples
swiftparse-platformframeworkscocoapodscarthage

Swift, iOS 8+ private shared library dependency issue


First some context:

I have followed the answer to this question I posted on how to share Swift code between two iOS application. @Silvan-Mosberger kindly gave me a step-by-step recipe using Carthage that I am following.

The private shared framework uses only Carthage for dependency management, but my consuming application uses both Carthage and Pods (because some frameworks are only available with Pod).

My consuming application uses Carthage for all of the frameworks that are also used by the shared library. That is to say, the Cartfiles look the same except the consuming app also has a dependency on the shared framework.

My issue (I think) is with the Parse framework, the ParseUI framework and ParseFacebookUtilsV4 framework. Parse can be used with Carthage, but ParseUI and ParseFacebookUtilsV4 cannot.

I am using Pod for the ParseUI and ParseFacebookUtilsV4 frameworks. However, both those frameworks depend on Parse. Thus, there is a Parse framework provided by Pod (and one provided by Carthage). They should be the same version (I don't specify a version).

Now to the actual problem (TL;DR):

When I run my application, it dies immediately with the following error:

dyld: Library not loaded: @rpath/Parse.framework/Parse
  Referenced from: /var/containers/Bundle/Application/6B8D5312-7690-477F-B406-3CA8F5C994CF/x.app/x
  Reason: Incompatible library version: x requires version 1.0.0 or later, but Parse provides version 0.0.0

Could this be an issue with 2 Parse frameworks? Perhaps something completely different?

Any help would be greatly appreciated.

Peter...

UPDATE

So, to try and figure out what is going on, I created a new application project to mimic the app that is failing. I am using an identical Carthage file and Podfile.

The new app seems to work as expected. I can call methods in the Parse library. No crash.

Thinking that perhaps the pod stuff in the crashing app were "stale", I found a way to force pod update here using the following:

#!/usr/bin/env bash

rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update

Unfortunately, this did not help. The application still crashes as shown above.

Does anyone have any suggestions on what this might be? Any suggestions on how to go about determining what is wrong?

I could really use some help :).


Solution

  • I stumbled (and I mean stumbled after days of searching) across this post:

    "Incompatible library version" when run on device

    and, long story short, by updating my CocoaPods to 1.0.1, the problem simply and magically went away.

    I hadn't tried the app on a simulator. When I did, it ran without the dyld error which led me to (what I hope is) the solution.