Error: Undefined symbols for architecture arm64 - ios

I use this pod to show ads in the app: https://cocoapods.org/pods/AdColony
I completed the SDK implementation with no errors.
But I'm getting this error when I try to run the app on the device: (iPhone)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_SKAdImpression", referenced from:
objc-class-ref in AdColony(ADCAdSession.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
What I tried:
In build settings, set ARCHS = armv7 armv7s and VALID_ARCHS = armv6 armv7 armv7s arm64.
In build settings, added $(inherited) to Other Linker Flags.
In build settings, set Build Active Architecture Only to YES.
Downloaded the pod added to the project manually.
Checked the minimum deploy target version of the SDK. That fits with the project.
Unchecked Parallelize Build in Product > Scheme > Edit Scheme
How can I solve this problem?

Related

Cannot build release app - Undefined symbols for architecture armv7

I'm building app on iOS (Xcode) using Flutter. Debug build works well, however when I build for release, I receive an error.
ld: warning: ignoring file /Users/mac/Library/Developer/Xcode/DerivedData/Runner-goymfovmnvitvmgsgblaexbdslkp/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/stripe_native/stripe_native.framework/stripe_native, building for iOS-armv7 but attempting to link with file built for iOS-arm64
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_StripeNativePlugin", referenced from:
objc-class-ref in GeneratedPluginRegistrant.o
ld: symbol(s) not found for architecture armv7
I had a look around, tried to set Build Active Architecture Only to No, Link Binary to Libraries - nothing seemed to work.
What should I do in this case?
The underlying problem is iOS 11 has dropped support for the armv7 architecture and one of your Deployment targets is probably set to < 11.0 and another is set to >= 11.0 or not set. When the target is less than 11.0 armv7 is built, when the target is >= 11.0 or not set armv7 is not built.
The problem in my case was my app's deployment target was set to iOS 10, but my Pod's target was not set (thus building for the latest iOS 13). For this particular case it was for the UIDeviceIdentifier target. The error was:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_UIDeviceHardware", referenced from:
objc-class-ref in ....
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In this particular case I was just updating my pods so the pod's settings must've been cleared. In the Pod's target settings under the Build Settings tab, I set the iOS Deployment Target to 10.0 (same as the app) and it worked.
As an alternative, I could've set the app's deployment target to 11.0.

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_Twitter",

Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_Twitter", referenced from:
objc-class-ref in FirebaseTwitterAuthUI(FUITwitterAuth.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am having that error when I want to build the project.
Any idea how to fix this?
Error Explanation :
The error suggests that the compiler could not able to find the Twitter class while building the FirebaseTwitterAuthUI for arm64 architecture. It is because of Architecture settings.
Check the Build Active Architectures Only setting from the Build Settings. Make sure that this should be same for your application target and for the cocoapods target.
If you still face the issue, post the screenshot of your Xcode with build setting.
Target -> Build Settngs -> Build Active Architecture Only.
Build Active Architecture flag => Yes indicates that build the current app only for the selected simulator architecture. It will make build faster.
Build Active Architecture flag => No indicates that build the current app for all the architectures.
So if you have multiple targets with different options, you will be able to get this kind of error.
Build Active Architecture flag => Yes for Debug and => No for Release mode.
check this :_OBJC_CLASS_$_FIRPhoneAuthProvider", referenced from: objc-class-ref in LoginVC.o Getting this error
Check that the framework you are importing has that architecture defined:
In terminal run:
lipo -info
The output should be something like:arm64 armv7 armv7s
If not,
1. your library is wrong and is missing that architecture
2. Your build settings doesn’t include that architecture
3. You are not linking the library correctly

No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7, VALID_ARCHS=armv6 i386)

I am getting this error while building my iOS app.
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7, VALID_ARCHS=armv6 i386).
I am followings errors while I am trying to use _ACAccountTypeIdentifierTwitter:
Undefined symbols for architecture armv7s:
"_ACAccountTypeIdentifierTwitter", referenced from:
-[ClsHomePageViewController twitterLogin:] in ClsHomePageViewController.o
"_OBJC_CLASS_$_ACAccountStore", referenced from:
objc-class-ref in ClsHomePageViewController.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And my Architecture settings are as follows:
architectures: Standard Architectures (including 64-bit) (armv7,armv7s,armv64)
Base SDK: Latest iOS (iOS 7.0)
Build Active Architecture Only: NO
Valid Architectures: arm64 armv7s armv7
Go to your project, open Project (not target) ->Build Settings and set Build Active Architecture Only to NO:
1.Please check your project Architectures.
You can find about architectures follow this:
From your target - Build Settings - Architectures, see the screenshot.
2.The Build Active Architecture Only the following Debug is set to YES.
Reference:iOS currently has the following instruction set:
(1). armv6, support machines iPhone, iPhone2, iPhone3G and the corresponding iTouch
(2). armv7, support machines iPhone4, iPhone4S
(3). armv7s, support machines iPhone5, iPhone5C
(4). arm64, support machines: iPhone5S
You can add armv7 in you valid architecture list.

CocoaPods not linking with the project

I have a project that uses CocoaPods. It was working but something got broken.
It does compile if I target the simulator, but If I target the devise (Build or Archive) it throws a linker error.
ld: warning: ignoring file /Users/myuser/ios/share/share/libPods.a, file was built for archive which is not the architecture being linked (armv7s): /Users/myuser/ios/share/share/libPods.a
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_AFHTTPRequestOperationManager", referenced from:
objc-class-ref in BackendProxy.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I really need some help because I am really stucked.
Thanks!
EDIT: i deleted that libPods.a, that was an old one, and now it's giving me:
ld: library not found for -lPods
But only on Archive or Build for iosDevice, this is still working on the simulator.
Try removing armv7s from valid architectures section.
Build Settings -> Architectures -> Valid Architectures

Build Static Library in Xcode 4.6 for Simulator

How to build a static library for simulator on Xcode 4.6?
I've tried "https://github.com/kstenerud/iOS-Universal-Framework". But got an error while using that framework on demo.
Error is like:
ld: warning: ignoring file /Users/shuvo/test_lib/Demo(V.1)/myProject.lib/libMyProjectLibrary.a, missing required architecture i386 in file /Users/shuvo/test_lib/Demo(V.1)/myProject.lib/libMyProjectLibrary.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_showScreen", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I came across the same problem,and solve it by setting the static lib's run configuration as Release in the scheme editor.
here is the words in the document of iOS-Universal-Framework, section "Building your iOS Framework":
step 2.(optional) Set the "Run" configuration in the scheme editor.
It's set to Debug by default but you'll probably want to change it to
"Release" when you're ready to distribute your framework.
the key is the "Build Active Architecture Only" in Build Settings,
Debug is set to NO by default

Resources