1

I've developped a framework which I want to use in my projects. Everything went right until I tried to build my project. Here the error description :

Undefined symbols for architecture arm64:  
  "_OBJC_CLASS_$_ClassInFramework", referenced from:
      objc-class-ref in ClassInMyProject.o  
ld: symbol(s) not found for architecture arm64

My Architectures build settings are :

$(ARCHS_STANDARD)  

and arm64 armv7 armv7s for valid arch
(same settings in my project and my framework, there are all default settings)

I can import myframework and build with no issue, but I get that error when I tried to use a class.

I'm on XCode 8.2.1, my Framework is a Cococa touch Framework, written in Objective-C, my project is written in Swift 3.0

I imported my framework by copying the output from Products and added it in Linked Frameworks and Libraries in my project

I've tried several different settings but none of them work.

Caleb Kleveter
  • 11,170
  • 8
  • 62
  • 92
Karag
  • 11
  • 3
  • I add my frameworks differently (and they are all in Swift), so this may be useless. Is the framework added to "Embedded Binaries" in your project? –  Jan 18 '17 at 14:52
  • No it was not added by default, I tried to add but same error. – Karag Jan 18 '17 at 14:56
  • Did you build the framework for the simulator and are running the project on a device? The architecture for a device is different than for a simulator – 0xT0mT0m Jan 18 '17 at 14:57
  • You might find your answer somewhat (but I'm not sure) similair to: http://stackoverflow.com/questions/29634466/how-to-export-fat-cocoa-touch-framework-for-simulator-and-device – 0xT0mT0m Jan 18 '17 at 14:58
  • I built both on devices or simulators, but still get the same errors. Maybe I'm not importing in the right way? – Karag Jan 18 '17 at 15:18
  • This is a two year old question with answers addressing bridging headers. Hopefully this isn't outdated and of help: http://stackoverflow.com/questions/24057756/import-framework-in-swift-project-xcode?rq=1 –  Jan 18 '17 at 15:28
  • Unfortunatly same error with a bridging header :( – Karag Jan 18 '17 at 15:59
  • That's all I have. I think it's related to the mix of Obj-C and Swift. Having said that, here's an answer on how I import my framework into a project (specifically, item #2). Keep in mind, this is two separate project (both Swift) that are obviously two frameworks. Maybe it'll work for you. My last chance at helping.... http://stackoverflow.com/questions/41207622/how-to-make-same-ios-swift-app-with-only-some-differences-in-the-code-and-assets/41209283#41209283 –  Jan 18 '17 at 16:04
  • Well, thanks for your answers and help. I think i will do something similar to your answer. – Karag Jan 18 '17 at 16:13
  • If it does, could you post something? I'd like to know that mixing Obj-C and Swift this way works. –  Jan 18 '17 at 16:17

2 Answers2

0

You should remove the project folder from Xcode Drived Date and restart your Xcode then clean your project and run it.

  • I'm stil getting the same error :(. I even tried recreate the project, reimport, still getting the error. – Karag Jan 18 '17 at 15:27
0

I didn't solve my issue but I've managed to do something similar.
Instead of creating a Cocoa touch framework I created a Cocoa Touch static library and it worked.

  1. I build my library,
  2. I get the products (*.h and .a files), copy them in my project,
  3. I add the lib.a in Linked Frameworks and libraries,
  4. I create the Bridging Header and #import my "customlib.h",
  5. Magic ! It works I can use my class.
Karag
  • 11
  • 3