在OC项目中引入Swift会导致编译错误

时间:2018-05-30 08:47:05

标签: ios objective-c swift xcode

该项目是OC,是一个包含多个子xcodeproj的xcworkspace,我修改了子xcodeproj中的代码,我在子xcodeproj中创建了一个Swift对象,并按下Xcode提示添加了Bridging-头文件,编译出以下错误。如何解决此编译错误?



Undefined symbols for architecture arm64:
  "__swift_FORCE_LOAD_$_swiftMetal", referenced from:
      __swift_FORCE_LOAD_$_swiftMetal_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftMetal_$_Business)
  "__swift_FORCE_LOAD_$_swiftQuartzCore", referenced from:
      __swift_FORCE_LOAD_$_swiftQuartzCore_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftQuartzCore_$_Business)
  "__swift_FORCE_LOAD_$_swiftDispatch", referenced from:
      __swift_FORCE_LOAD_$_swiftDispatch_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftDispatch_$_Business)
  "__swift_FORCE_LOAD_$_swiftCoreFoundation", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreFoundation_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreFoundation_$_Business)
  "__swift_slowAlloc", referenced from:
      _swift_rt_swift_slowAlloc in libBusiness.a(TestSwift.o)
  "__swift_FORCE_LOAD_$_swiftCoreGraphics", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreGraphics_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreGraphics_$_Business)
  "__swift_FORCE_LOAD_$_swiftFoundation", referenced from:
      __swift_FORCE_LOAD_$_swiftFoundation_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftFoundation_$_Business)
  "__swift_FORCE_LOAD_$_swiftDarwin", referenced from:
      __swift_FORCE_LOAD_$_swiftDarwin_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftDarwin_$_Business)
  "__swift_FORCE_LOAD_$_swiftUIKit", referenced from:
      __swift_FORCE_LOAD_$_swiftUIKit_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftUIKit_$_Business)
  "__swift_FORCE_LOAD_$_swiftCoreImage", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreImage_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreImage_$_Business)
  "__swift_slowDealloc", referenced from:
      _swift_rt_swift_slowDealloc in libBusiness.a(TestSwift.o)
  "__swift_FORCE_LOAD_$_swiftObjectiveC", referenced from:
      __swift_FORCE_LOAD_$_swiftObjectiveC_$_Business in libBusiness.a(TestSwift.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftObjectiveC_$_Business)
  "value witness table for Builtin.UnknownObject", referenced from:
      full type metadata for Business.TestSwift in libBusiness.a(TestSwift.o)
  "__swift_getInitializedObjCClass", referenced from:
      _swift_rt_swift_getInitializedObjCClass in libBusiness.a(TestSwift.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)




0 个答案:

没有答案