Why do I get iOS linker errors with my static libraries?(为什么我的静态库会出现 iOS 链接器错误?)
问题描述
I have a problem with linking my mixed language framework to a project.
I create a framework with Swift and Objective-C classes.
The main logic was stored in the Swift file. For example the class with a method that calls NSLog("Swift log was called").
Objective-C file has a class that has a method in which I create an instance of Swift class and call Swift-log method.
I link this framework with my Objective-C project, I can call all that I need in this project, but when I want to build this project I receive error
linker command failed with exit code 1 (use -v to see invocation)
And warnings:
I also saw the solution with importing empty Swift-file, but it necessary to make a project without any trash.
- Open ios/YourAppName.xcodeproj in Xcode
- Right-click on Your App Name in the Project Navigator on the left, and click New File…
- Create a single empty Swift file to the project (make sure that Your App Name target is selected when adding)
- when Xcode asks, press Create Bridging Header and do not remove Swift file then. re-run your build.
This should fix the problem
这篇关于为什么我的静态库会出现 iOS 链接器错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!