André
André

Reputation: 53

Linking third party frameworks to my own framework, distributed using Carthage

We have several different proprietary API provided to us as Frameworks that offer similar functionality. The API is of course not identical, so we want to build a wrapper facade Framework around these, so our apps do not need to care which of the API they are using.

As a start, I have created a framework that uses one of these APIs and has unit tests that verifies that it works as expected. We have added the third party framework binary as a part of the project, and the Framework search path is like this:

$(inherited)
$(PROJECT_DIR)/Carthage/Build/iOS
$(PROJECT_DIR)

All non-recursive. The Cartage path is here because we use Quick and Nimble for our unit tests. I have the framework in question stored at the project root.

We want to distribute our framework using Carthage, and later also as a Cocoapod.

The problem is that when I try to build our framework by the command: carthage build --no-skip-current --platform iOS, I get the error:

*** Building scheme "Nimble-iOS" in Nimble.xcodeproj
*** Building scheme "Quick-iOS" in Quick.xcworkspace
*** Building scheme "XXX" in XXX.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/andre/Development/yyy/xxx/XXX.xcodeproj -scheme XXX -configuration Release -sdk iphonesimulator -destination platform=iOS\ Simulator,id=AE9E3D9D-BE2C-4AE1-AB37-C6BE8948067B -destination-timeout 3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build (launched in /Users/andre/Development/yyy/XXX)

And the log contains this:

iphonesimulator/XXX.build/Objects-normal/i386/XXXLockService.o
/Users/andre/Development/yyy/XXX/XXX/LockServiceFactory.swift:7:71: error: 'PinServiceAccessImpl' is unavailable: cannot find Swift declaration for this class
                     case .xxx: return XXXLockService(lockService: PinServiceAccessImpl.getInstance())
                                                                   ^~~~~~~~~~~~~~~~~~~~

PinServiceAccess.PinServiceAccessImpl:2:12: note: 'PinServiceAccessImpl' has been explicitly marked unavailable here
open class PinServiceAccessImpl : NSObject {

When using a framework from an app, the documentation states that we should add the framework's as an embedded binary, but this option is not available when the project is a framework.

What puzzles me is that the unit tests seems to find the PinServiceAccessImpl.getInstance()!

I guess there are some details about linking that I don't know about that makes the build fails. Does anyone have an idea of what we are missing out?

Upvotes: 0

Views: 353

Answers (1)

André
André

Reputation: 53

The problem got solved when updating the deployment target to 11.0.

Upvotes: 0

Related Questions