We have a static framework that we have built and it depends upon an SDK that we use to access ID's. This SDK has come out with a new version which has a new interface.
Currently the user would add our framework and the dependency SDK and everything would work fine. Now we want the user to be able to add our framework and either the old or new SDK and I'm not sure how to do this without creating multiple targets which we would rather not do. With the way I have it setup the user has to add our SDK and both the old and new SDK's.
I have a protocol SDKProtocol
which is implemented by two classes NewSDKServices
and OldSDKServices
.
NewSDKServices
won't compile unless the new SDK is present and OldSDKServices
won't compile unless the old SDK is present. I figure this is OK since it is a precompiled framework and we can decided at runtime which to use.
Then I'd like to be able to do something like this, maybe with a ifdef
to import and initialize the correct service.
if (useNewSDK) {
_sdkService = [[NewSDKServices alloc] init];
} else {
_sdkService = [[OldSDKServices alloc] init];
}
I've thought about weak linking these libraries but not exactly sure how it would work since you can't static link frameworks to other static frameworks. I'm hoping for some direction.
Both SDK's have a few headers and a .a
.