Connors Apps
Connors Apps

Reputation: 131

importing swift framework only working on Simulator

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.

Upvotes: 2

Views: 704

Answers (2)

user3826696
user3826696

Reputation: 1135

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

Upvotes: 1

Alejandra Vidal Ortiz
Alejandra Vidal Ortiz

Reputation: 181

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

Upvotes: 2

Related Questions