importing swift framework only working on Simulator - ios

I have been trying to import this swift framework into a objective c project called CreditCardForm but it fails to run. It will run on a real iPhone but when it comes to the simulator it gives be this error.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$__TtC14CreditCardForm18CreditCardFormView", referenced
from:
objc-class-ref in CreditCardVC.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
1 (use -v to see invocation)
I have been trying to get it to run but it has only ran for the simulator only or the iPhone only.

Make sure the framework is built in both Device/Simulator
If the project is built only in “Simulator”, it would only generate architectures which would let the framework run specifically on simulators not on Devices. Or if the project is built in “Device”, it would generate architectures which would let the framework to run only on devices.
So build the project on both “Simulator” and “Device”.
https://medium.com/swiftindia/build-a-custom-universal-framework-on-ios-swift-549c084de7c8

Build a Fat Library
A fat library is simply a library with multiple architectures. In our
case it will contain x86 and arm architectures. The proper name is
‘Universal Static Library’. But we will stick with ‘fat library’ since
its smaller to write and that is exactly what our resultant library
would be. Fat!!! with multiple architectures in it.
https://medium.com/#hassanahmedkhan/a-noobs-guide-to-creating-a-fat-library-for-ios-bafe8452b84b

Related

Apple Mach-O linker error _OBJC_CLASS_$_FIRInstanceID

I've been trying to implement Firebase Notifications to a project that has alot of targets (like 13). I've been struggling but finally made it work on my test device, being able to show notifications when sent by an app called Postman.
The thing is I installed the frameworks by not using cocoapods because whenever I tried to do Pod install, my project couldn't build forcing me to rollback and try it again. So I opted to use this tutorial: https://www.mokacoding.com/blog/setting-up-firebase-without-cocoapods/
The app was working fine so I tried to archive it, to publish to testflight, and people told me to always use the Generic iOS Device when publishing to Testflight, so the application works on every device and not only on the one I'm testing.
But when I tried to build the project but on a Generic iOS Device I get the error:
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_FIRInstanceID", referenced from:
objc-class-ref in MyINFOAppDelegate.o
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in MyINFOAppDelegate.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Not being able to archive and send it to testflight.
What should I do? Already saw a ton of posts of things I did but not able to solve :(
Make sure that the Architectures Build Setting does not include armv7s. By default, Architectures is defined to $(ARCHS_STANDARD) which maps to "armv7 arm64"
Firebase binary distributions don't include armv7s - only armv7, i386, x86_64 and arm64.

mergZXing build issue

Having an issue building for iOS. Getting "linking for arm (arm64) failed with Undefined symbols for architecture arm64: "____libinfoptr_mergZXing", referenced from: -u command line option
Any ideas what might be wrong? Let me know if you need additional details
When you get linking errors with iOS externals it means it either hasn't been compiled for the SDK or architecture you are building against. In this case it's telling you it hasn't been compiled against arm64. The good news it that there are universal binary builds (armv7 arm64) available for download from mergExt.com for up to iOS 8.2. iOS 8.3 builds will be coming ASAP.

Linker error on the new xcode (ios 8.2 simulator) in cocos2d-x

I've recently updated xcode to the last version. So now my simulator have 8.2 ios version. My cocos2d-x projects are still working on devices (tested on ipad2 and iphone5s), but I can't compile them for simulator. I'm getting huge number of linker errors:
Undefined symbols for architecture x86_64:
"_AVAudioSessionCategoryAmbient", referenced from:
-[CDAudioManager setMode:] in libcocos2d iOS.a(CDAudioManager.o)
-[CDAudioManager applicationWillResignActive] in libcocos2d iOS.a(CDAudioManager.o)
...
few hundred lines more
...
ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed
with exit code 1 (use -v to see invocation)
Showing first 200 notices
only Showing first 200 errors only
Generally there are errors of all frameworks I use as well as cocos2d-x library itself. Before getting there most frameworks was highlighted red, but I fixed that making a symlink to:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
using this:
sudo ln -s iPhoneOS.sdk iPhoneOS8.1.sdk
I'm of course using cocos2d-x 3.4.
edit:
After migrating to v. 3.5, setting valid architectures to: armv7, armv7s, i386, x86_64, setting build active architecture only to no (in both main and cocos2d_libs project) with various settings variations now I'm getting:
Undefined symbols for architecture i386:
And other's the same. Doesn't work on any simulator. I even downloaded 8.1 simulators and it doesn't work there too. This is some stupid linker error and I can't figure it out.
I've also noticed that fresh project builds fine. In my project I also have few objC classes (for other stuff like admob), which are using ARC. So I had to add "-fobjc-arc" in few places in build phases->compile sources. Problem is it's only simulator-related problem and appeared when I've updated ios sdk from 8.1 to 8.2.
Regards

Xcode 6 Error - "Missing Required Architecture i386" When Building for iOS Simulator

I have created a custom Objective-C framework. I would like to import it into any given iOS project and use its provided functionality on both the iOS Simulator and an actual device. To import the framework, I link it using the Build Phases > Link Binary With Libraries setting in the app's target. I'm then able to import it into one of my classes with this statement:
#import <CustomFramework/CustomFramework.h>
I can instantiate my framework's classes just fine, but when I try to run my project on a device, I get the following error message:
dyld: Library not loaded: #rpath/CustomFramework.framework/CustomFramework
Referenced from: /var/mobile/Applications/A61E882D-481A-4C0B-B4FD-69F5D24968BF/TestApp.app/TestApp
Reason: image not found
And if I try to run it on the simulator, I get a different error message:
ld: warning: ignoring file /Users/user/Desktop/CustomFramework.framework/CustomFramework, missing required architecture i386 in file /Users/user/Desktop/CustomFramework.framework/CustomFramework (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CustomFramework", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This occurs when I instantiate a class from the framework. If I import the framework but don't actually use it, my app builds successfully. It just errors whenever I instantiate a class from the framework for some reason.
To get the app to build on a device, I followed this SO answer. Instead of linking the framework, I added a new Copy Files phase in the target's Build Phases setting, set the Destination to Framework, and added my framework.
That works great; however, I'd like to test my app on the iOS Simulator as well. When I try to run my app on the simulator, I still get the "missing required architecture i386" error. I've tried the solutions proposed at just about every related SO topic I could find, and nothing has helped me resolve this issue.
Please note that I am trying to use my custom framework in a new Xcode project, so none of the app/build settings have been changed from their defaults.
How can I fix this error so that I can run my app on both the iOS Simulator and a device with my framework included in the project? Any insight would be greatly appreciated!
The issue was that the framework was not compiled for the iOS Simulator's architecture, which is i386. Xcode only compiles a framework for the target architecture, so if I built the framework for the iOS Simulator, it wouldn't work on a device, and if I built the framework for a device, it wouldn't work on the iOS Simulator.
I created my framework from scratch with help from this tutorial: http://www.raywenderlich.com/65964/create-a-framework-for-ios
The multi-architecture build script is what allowed my framework to run on both the iOS Simulator and a device.
I encountered this same problem with Xcode 7.1 when trying to build for the simulator.
Someone else said it worked for them under Xcode 8.2.1, so I tried building/running there and it worked. I didn't have to change targets or anything in my project.
So try upgrading your Xcode if you can, you will presumably get additional bug fixes as well.

Google Conversion Tracking for iOS linker error for architecture armv7

I'm trying to add the Google Conversion Tracking for iOS feature to my iPhone app.
The app's base SDK is iOS6
the app's valid architectures is armv7, armv7s
the app's iOS deployment targer is 4.3
I'm using the latest xcode 4.5.2 and OSX 10.8.2
The app is in appstore and is ok for iPhone 3-4-5
When I try to add the Google Conversion Tracking for iOS following this link: https://developers.google.com/mobile-ads-sdk/docs/admob/conversion-tracking
I have this error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleConversionTracking.a(PingUtil.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The SDK library references the iOS AdSupport development framework
which may not already be part of your project. It can be resolved by
including AdSupport.Framework.
To adding the Framework, just follow the steps below. Select the
project file at the top. Open the Link Binary With Libraries drop-down
under the Build Phases tab. Add the framework from the iOS SDK using
the + button.

Resources