我在将混合语言框架连接到项目时遇到了问题。
我使用Swift和Objective-C类创建了一个框架。
主要逻辑存储在Swift文件中。例如,一个调用NSLog("Swift log was called")方法的类。
Objective-C文件有一个类,其中包含一个方法,在该方法中我创建一个Swift类的实例并调用Swift-log方法。
我将这个框架与我的Objective-C项目链接起来,我可以在这个项目中调用所有我需要的东西,但是当我想要构建这个项目时,我会收到错误信息
linker command failed with exit code 1 (use -v to see invocation)
还有警告:
ld: warning: Could not find auto-linked library 'swiftFoundation'
ld: warning: Could not find auto-linked library 'swiftDarwin'
ld: warning: Could not find auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find auto-linked library 'swiftCore'
ld: warning: Could not find auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find auto-linked library 'swiftObjectiveC'
ld: warning: Could not find auto-linked library 'swiftDispatch'
ld: warning: Could not find auto-linked library 'swiftSwiftOnoneSupport'
我也看到了通过导入空的Swift文件来解决问题的方法,但这会使项目中出现无用的文件。