Objective C - Apple Mach - O Linker Error - ios

I'm using social sharing phonegap plugin for my mobile app project. I got this problem when build the project. I got a several of error. I'm using this phonegap plugin for my social sharing function. Check https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.
Undefined symbols for architecture armv7s:
"_SLServiceTypeTwitter", referenced from:
-[SocialSharing shareViaTwitter:] in SocialSharing.o
"_OBJC_CLASS_$_MFMessageComposeViewController", referenced from:
objc-class-ref in SocialSharing.o
"_SLServiceTypeFacebook", referenced from:
-[SocialSharing shareViaFacebook:] in SocialSharing.o
"_OBJC_CLASS_$_SLComposeViewController", referenced from:
objc-class-ref in SocialSharing.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Why?

Add the frame works by using the following steps:
In the project navigator, select your project
Select your target
Select the 'Build Phases' tab
Open 'Link Binaries With Libraries' expander
Click the '+' button
Select framework (MessageUI.framework and Social.framework in your case)

I had the same issue as well, and I followed the steps mentioned here:
https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues/116
So, basically I remove the platform:
cordova platform remove ios
Then add it back:
cordova platform add ios
Hope it helps!

Related

Apptentive: `Undefined symbols for architecture...` error in Cordova project

I'm trying to use Apptentive in Cordova project. While building my Xcode project I'm getting error:
Undefined symbols for architecture arm64:
"_CGImageSourceCreateWithURL", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_kCGImageSourceCreateThumbnailWithTransform", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_kCGImageSourceThumbnailMaxPixelSize", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_OBJC_CLASS_$_QLPreviewController", referenced from:
objc-class-ref in libApptentiveConnect.a(ATAttachmentController.o)
objc-class-ref in libApptentiveConnect.a(ATMessageCenterViewController.o)
"_kCGImageSourceCreateThumbnailFromImageAlways", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_CGImageSourceCreateThumbnailAtIndex", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_CGImageSourceCopyTypeIdentifiers", referenced from:
___50+[ATFileAttachment canCreateThumbnailForMIMEType:]_block_invoke in libApptentiveConnect.a(ATFileAttachment.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There is a similar question on StackOverflow, but the solution didn't work for me :/
Looks like I have all the required dependencies, also I've added -lApptentiveConnect flag for linker.
Frameworks
It looks like there are some required system frameworks that aren't being linked automatically.
You need to link against AVFoundation, CoreData, CoreGraphics, Foundation, ImageIO, MobileCoreServices, QuartzCore, SystemConfiguration, UIKit and weak link StoreKit and CoreTelephony.
Step by step:
Select your project in the project navigator in Xcode.
Select your target from the list of targets.
Select the Build Phases tab.
Expand the Link Binary with Libraries group.
Click the + Button and select the aforementioned frameworks (including the two weak-linked ones). You can ⌘-click to select more than one.
When you're back at the list of libraries, select "Optional" for the two weak-linked frameworks.
You should then be able to build and run successfully.

Linking errors when trying to install Google signin

I am trying to integrate Google Sign In into my iOS Apps but while doing this i am getting below error.
Is there any solution to remove below errors?
Undefined symbols for architecture armv7: "_inflate", referenced
from:
l002 in GoogleSignIn(GTMNSData+zlib.o) "_deflate", referenced from:
l001 in GoogleSignIn(GTMNSData+zlib.o) "_inflateEnd", referenced from:
l002 in GoogleSignIn(GTMNSData+zlib.o) "deflateInit2", referenced from:
l001 in GoogleSignIn(GTMNSData+zlib.o) "inflateInit2", referenced from:
l002 in GoogleSignIn(GTMNSData+zlib.o) "_deflateEnd", referenced from:
l001 in GoogleSignIn(GTMNSData+zlib.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
This is very common error and doesn't have any specific solution. Although may be following workaround may help you:
If you are not using cocoa-pods use them to add new repos.
Check that you haven't imported .m instead of .h.
Check you haven't add two frameworks accidenlty.
Remove -ObjC Linker flag from `-otherLinkerFlags'
Sometimes using older version of sdk may solve the problem.
Navigate to YourProject--Build Phases and check you haven't added one file more than once. And also any Link Binary and Libraries are not missing from there.
Here is the Image Showing OtherLinkerFlags
For More Detail Refer to this Link
Good Luck... :)
You can fallow below steps
Go to Build settings / Linking / Other Linker Flags and add the "-ObjC" without the quotes. This assume you are using some "header
file" to map Google framework and for Swift approach.
Go to Build Phases >Link Binary with Librairies > + > Add other, the go to de /usr/lib directory and select "libz.dylib"
Compile
Adding -ObjC and libz solved my problem. However in my case I can't find libz.dylib in path /usr/bin. I used libz.tbd in the iOS 9.3 folder instead and it also worked fine and dismissed those same errors.

google admob undefined symbol for architecture armv7

i have replaced older version of admob 6.6.1 with latest admob library version 6.12.0 but i get this error although every thing is fine. I am using xcode 6.0.1, how to resolve this issue, any help?
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_EKEvent", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_OBJC_CLASS_$_EKEventEditViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I had same issue but i solved by adding eventKit and eventUIKit framework into my project. Hope it will work for you too.
This error is mostly because update of your ADMOB SDK.
1) Go to build phases->Open list of frameworks.
2) Locate libGoogleAdMobAds.a. Remove this file by pressing - sign.
3) Again add this libGoogleAdMobAds.a file back by pressing + sign and selecting "Add other". select this file from ADMOB folder of your project.
4) Clean, then build and run your project.
Also, check you have -ObjC set to Other Linker Flags in your project's target build settings and required frameworks are added.
add Framework EventKit and EventKitUI.

Other Linker Flags set to -ObjC [duplicate]

This question already has an answer here:
What causes iOS linking errors?
(1 answer)
Closed 9 years ago.
I have included Other Linker Flags set to -ObjC in my Build Settings as I would like to use a framework that requires this (https://github.com/rs/SDWebImage)
However after adding this flag I get linker errors:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_SKProductsRequest", referenced from:
objc-class-ref in Parse(PFPurchase.o)
"_OBJC_CLASS_$_SKPayment", referenced from:
objc-class-ref in Parse(PFPurchase.o)
"_OBJC_CLASS_$_SKPaymentQueue", referenced from:
objc-class-ref in Parse(PFPurchase.o)
objc-class-ref in Parse(PFPaymentTransactionObserver.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Removing the -ObjC linker flag and the project builds again without errors. Any ideas of the cause? Thanks.
You need to add StoreKit.framework.
Version 1.0.62 of the Parse iOS SDK introduced In-App Purchases. This requires StoreKit.framework to be added to existing Parse iOS projects, even if IAP is not being used.
Do this:
Select your project
Select your target
Select Build Phases
In Link Binaries with Libraries, click +
Search for StoreKit and Add
Then import the framework to your project:
#import "StoreKit/StoreKit.h"
See the same error in this Parse community link.
add Storekit framework in your project and use this statement where you use write code for In App Purchage
#import "StoreKit/StoreKit.h"

Error While Integrating iAd Adapter in Admob Mediation SDk

I am trying to integrate iAds in Admob mediation SDK for that purpose, I downloaded iAdListAdapter from Mediation website Download Link and added it into my xcode project but now when I try to compile the project it is giving following error:
Undefined symbols for architecture i386:
"_ADBannerContentSizeIdentifierLandscape", referenced from:
-[GADMAdapterIAd getBannerWithSize:] in libAdapterIAd.a(GADMAdapterIAd.o)
-[GADMAdapterIAd adjustADBannerToAdSize] in libAdapterIAd.a(GADMAdapterIAd.o)
"_ADBannerContentSizeIdentifierPortrait", referenced from:
-[GADMAdapterIAd getBannerWithSize:] in libAdapterIAd.a(GADMAdapterIAd.o)
-[GADMAdapterIAd adjustADBannerToAdSize] in libAdapterIAd.a(GADMAdapterIAd.o)
"_OBJC_CLASS_$_ADBannerView", referenced from:
objc-class-ref in libAdapterIAd.a(GADMAdapterIAd.o)
"_OBJC_CLASS_$_ADInterstitialAd", referenced from:
objc-class-ref in libAdapterIAd.a(GADMAdapterIAd.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please guide what am I doing wrong or what is the correct way of adding iAds to Mediation SDk by the way: I am using XCode 4.6 with min sdk 5.0
Any help is really appreciated!
Turned out that i needed to add iAd.Framework and remove -all_load Flag in the project, which solved the Problem.
For People who use auto linking please include "#import < iAd/iAd.h >" in any of your source files/

Resources