Cannot build release app - Undefined symbols for architecture armv7 - ios

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.

Related

Error: Undefined symbols for architecture arm64

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?

Flutter ios archive app undefined symbols

I'm trying to archive an app on the apple store but I get this error, everything works correctly in debug. How can I fix it?
Undefined symbols for architecture armv7:
"OBJC_CLASS$_MDFTextAccessibility", referenced from:
objc-class-ref in MDCTypography.o
"_MDFInsetsFlippedHorizontally", referenced from:
-[MDCFloatingButton insetBoundsForBounds:] in MDCFloatingButton.o
"_MDFRectFlippedHorizontally", referenced from:
-[MDCAlertControllerView layoutHorizontalButtons:actionSize:] in MDCAlertControllerView+Private.o
-[MDCAlertControllerView layoutVerticalButtons:] in MDCAlertControllerView+Private.o
-[MDCItemBarFlowLayout flippedAttributesFromAttributes:] in MDCItemBar.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing All Messages
Undefined symbol: OBJC_CLASS$_MDFTextAccessibility
Undefined symbol: _MDFInsetsFlippedHorizontally
Undefined symbol: _MDFRectFlippedHorizontally
Thanks!
my pod installation
My pod file
Pod in my solution:
enter image description here
Go to Build setting search Valid Architecture:
Remove armv7 from the list
If you are using Xcode version > 12.0 Then go project or target -> Build Settings -> Excluded Architecture
Then Add armv7
OR
If above do not work Then set your Run to Any iOS Device(arm64)
Now archive your build.
Set the parameter iOS Deployment Target of MaterialComponents pods to iOS 11.0
https://github.com/jonasbark/flutter_stripe_payment/issues/217

Adding third party library sqlcipher in ios

I am trying to integrate SQLCipher in one of my existing project with deployment target 6.0 but since sqlcipher supports 9.0 as its minimum deployment target ,so I changed the deployment target to 9.0 now.
With this I made a change in build setting also,I changed "Build active architecture only" to yes.I tried building the app then.But it shows few errors related to already existing classes.
Error-"Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ConditionViewController", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)".
Valid Architecture- armv7 arm64
I am not able to figure out this error and fix it.Kindly help me to resolve it.Any help would be appreciated.

IOS App Archive Failing - 2 errors

I have just added 64 bit support for my iPad app in Xcode. Before the update i was able to archive the app with no red errors. After i add arm64 in the build settings get 2 error preventing the archive:
*ld: warning: ignoring file /Users/****/Documents/mApp/****/Pixate.framework/Pixate, missing required architecture arm64 in file /Users/****/Documents/mApp/****/Pixate.framework/Pixate (3 slices)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_Pixate", referenced from:
objc-class-ref in main.o
objc-class-ref in BaseView.o
objc-class-ref in BaseViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)*
I have checked the framework and it is showing in the frameworks in the project.
I am currently using Xcode version 6.3.2 (6D2105)
The problem is related to third party framework Pixate.framework.
This framework is not built for arm64. That's why you got these errors.
How to fix it: find the version of this framework that was built with arm64 or just build it yourself by getting code from GitHub

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