2
votes

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.

2
From the error code it seems like the framework doesn't support the 64bit architecture. Which iPhone are you running your code on, is it 32bit or 64bit? Also what Architectures are you supporting in your project? - Dávid Pásztor
drag framework into the 'Link Binary with libraries' located under your target and thats it! or Build Active Architecture Only set yes - KKRocks
As I tested this code & it's working fine. Are you using cocoa pods or simply drag & drop approach to use this? - Virender
@Virender I am using the drag and drop but I could use cocoa pods if I need to. - Connors Apps
The way I am getting the framework is running the project. It creates the framework but it will not even work in a blank new app. - Connors Apps

2 Answers

2
votes

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

1
votes

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