将混合语言框架链接到项目时出现问题。
1)我创建了一个包含Swift和Objective-C类的框架。
2)主要逻辑存储在Swift文件中。例如,该类具有调用NSLog(“ Swift log was created”)的方法。
3)Objective-C文件具有一个类,该类具有一个方法,在该方法中,我创建了Swift类的实例并调用Swift-log方法。
4)我将此框架链接到我的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文件的解决方案,但是必须创建一个没有任何垃圾的项目。