link conflict with library - ios

I am creating an SDK that will be distributed as a lib (.a)
My SDK uses AFNetworking internally. If I try to put it in a project that also uses AFNetworking, I cannot link (I get duplicate symbols for the AFNetworking symbols)
Is there any way around this ?

Just notify linker to –force_load your static library,
Go to "Build Settings" -> "Other Linker Flags" and add "–force_load lib/your-lib/libyourlib.a" option.

Related

framework not found CometChatSDK

I have integrated CometChat Ready UI SDK in my iOS App. But when I try to build the code at that time I am getting following linker error ld: framework not found CometChatSDK
Following things I have added in my project
1) Framework search path is set to $(PROJECT_DIR) -> recursive
2) I have added -all_load , -ObjC , -lc++ in Other Linker Flag
3) Cometchat SDK is also showing in the Project -> Build Phases -> Link Binaries with Libraries
As you can see in beginner's guide of cometchat: https://support.cometchat.com/documentation/php/ios-chat-sdk/custom-ui/initial-setup/
Put the following in your Build Phases -> Link binary with libraries:
SystemConfigurarion.framework
MobileCoreServices.framework
CoreGraphics.framework
CFNetwork.framework
libxml2.dylib
libz.dylib
Next, Click on Targets → Your app name → and then the ‘Build Settings’ tab. Scroll down to the ‘Linking’ section, and double-click to the right of where it says ‘Other Linker Flags’. Click on the “+” button to add the following:
ObjC
all_load
Try semantic import if everything fail.
I have found following solution form the cometChat support team.
1) Change CometChatSDK.framework name to MessageSDKFramework.framework
2) Change your Import Statement #import<CometChatSDK/MessageSDK.h> to #import<MessageSDKFramework/MessageSDK.h>
Thank You

Integrate AppLovin With swift xcode 6.4

I want to integrate AppLovin With Xcode 6.4 and swift. I am Following the steps which are given in Documentation. I have added Headers and libAppLovinSdk.a Library in my project. Then I have added all the frameworks which are needed and added AppLovin SDK key into info.plist file. Then I have initialized ALSdk.initializeSdk() in Appdelegate.h file and I have added Bridging file in my project. Then I wrote -Objc in "Other Linker Flags"
I am getting this error
ld: 150 duplicate symbols for architecture i386 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
EDIT:
This is the error log.
Based on the linker errors (duplicate symbol _llvm.embedded.module) as well as the fact that you're using an older Xcode version, it may likely be a conflict/mismatch between the target/compiler of your project and the dependency. This isn't inherent to AppLovin, but can happen if the static library you're using is far too new or old for your Xcode version.
One possible occurrence of this is that we started compiling the library with Bitcode support, and I wouldn't be surprised if older versions of LLVM don't play nice with that.
I'd recommend pulling the latest version of libAppLovinSdk.a, and if at all possible, building using Xcode 7+.
Additionally, if you're using some dependency manager like Cocoapods or Carthage, you may have better luck directly (manually) integrating, given that they are maintained by third parties with no involvement from us.
You are initializing SDK at wrong place. At the time of didFinishLaunchingWithOptions: call, application has not been fully prepared. Try initializing it in method:
-(void)applicationDidBecomeActive:(UIApplication *)application
Also include -ObjC flag. It should solve duplicate symbols issue.

Swift project with cocoapods new errors when watchkit added

I have a working Swift IOS project that uses an Objective C SDK. The SDK code is installed and updated with cocoapods. There is a bridging header file in the Swift project. This project has been compiled and run many times, and is fully operational. And of course, since it has been built and run, the workspace file is how it is opened...
I added a watchkit extension to it. I ran pod update to make a new lock file. I confirmed the search path in the watchkit includes the pods/recursive. I added the header file to Watchkit Extension.
Those three steps are the only suggestions I've been able to find regarding making cocoapods managed code work with Watchkit.
I get three errors. they are:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_SparkCloud", referenced from:
__TMaCSo10SparkCloud in InterfaceController.o
"_OBJC_CLASS_$_SparkDevice", referenced from:
__TMaCSo11SparkDevice in InterfaceController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone have a suggestion for further steps that may allow the project to compile?
As mentioned in the question, this Swift IOS project uses cocoapods to manage an objective C SDK that provides access to a Cloud API.
Take these steps after adding the WatchKit Extension to the Xcode project.
In the project main folder (blue, top) Info tab, note that in the section Debug,there is an entry of None beside the WatchKit Extension. Change this to Pods.debug. Click on it and choose Pods.debug.
Under the Release section, change the WatchKit Extension from None to Pods.release
Now click on the WatchKit Extension Target and choose the General tab. Here the Linked Frameworks and Libraries will be empty. Click the plus sign and choose from the list libPods.a and add it, make sure the Required option (to the right) is selected.
That should finish the job of getting your cocoapods library accessible to the InterfaceController.swift file under WatchKit Extension, which is where you write the code that "runs" the watch.
It looks like you are missing the SparkCloud.framework in your project. You can add it by:
Clicking on your project in the upper left of the left pane (the blue icon).
Navigate to "Build phases."
Under "Link Binary With Libraries", click on the plus button.
Find the SparkCloud.framework from the list and hit Add. You may also want to add any other frameworks that are required for the Spark SDK.
This will ensure that the Spark frameworks are found by the linker.
Click build, and the error should go away.

Undefined symbols for architecture i386 linking facebook sdk

I am trying to link the facebook library to my app but i am getting this very strange error:
what does this mean? I got this to work on another app, the files and code are the same...
The error you are seeing is from the linker. When you compile your code, the compiler can find declarations for all the functions that you need, because you're including the facebook header (facebook.h). But when it comes time to link your program, the linker tries and fails to find compiled versions of those facebook methods. You need to bring the facebook SDK into your project and link against it.
The way I'm going to recommend linking against the Facebook SDK is actually one I haven't tried before, but it looks like the simplest way to get your project building:
Download and install the FacebookSDK framework from here.
Drag the FacebookSDK.framework bundle, which will end up in ~/Documents/FacebookSDK into your Xcode project.
When given the option, choose not to "Copy items into destination group's folder" and make sure that your application target is selected in the "Add to targets" section.
You may have to change your current #import/#include lines. To see the facebook methods from the framework you just imported, you should import like:
#import <FacebookSDK/FacebookSDK.h>

libOmnitureAppMeasurement-iPhoneSimulator.a not linking with iOS4 project

I have a Universal Project for iPad and iPhone running iOS 4.0. xCode 4.x
I follow the steps to include the above library into a new project.
I am getting the following error during linking:
We are getting,
“_OBJC_CLASS_$_OMAppMeasurement”
Ld: symbol not found for architecture i386.
I have other static library in the same project and those are working fine. In addition, I also try messing with Other Linker Flag, Header Search Path, Library Search Path. No luck.
Any idea?
EDIT:
Turns out it is a binary issue, instead of using the binary from developer.adobe.com, I was pointed to another binary and that worked OK for xCode 4.x.
The Omniture omappmeasurement libraries are shipped as separate binaries for the separate architectures, so you have to switch between them as you switch between the simulator and devices. You can join the binaries together with lipo:
lipo -create libOmnitureAppMeasurement-iphoneos-armv6.a libOmnitureAppMeasurement-iphonesimulator-i386.a -output libOmnitureAppMeasurement.a
Then add libOmnitureAppMeasurement.a to your project with 'Add Files to "..."...' in the usual way.
NOTE:
If you download them from this forum post you'll find that libOmnitureAppMeasurement-iphoneos-armv6.a contains both armv6 and armv7 code, and libOmnitureAppMeasurement-iphoneos-armv7.a contains armv7 only. Hence using the 'armv6' version above.
I got new libraries from here https://developer.omniture.com/en_US/gallery/app-measurement-for-ios and they work well on simulator and devices.
You will need to create an account to be able to download it.
These libraries are not any more supported by Apple as they use "uniqueIdentifier".

Resources