编译链接报错Undefined symbols for architecture arm64: referenced from :

报错: Undefined symbols for architecture arm64: “_OBJC_CLASS_$_类名”, referenced from : Objc-class-ref in 类名.o

编译链接报错Undefined symbols for architecture arm64: referenced from :_第1张图片
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_JCAlertController", referenced from:
      objc-class-ref in xxxx.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

说明在xxxx类中引用的_OBJC_CLASS_$_JCAlertController(也就是JCAlertController),在编译或链接阶段未找到而导致报错。

解决步骤:

1. 选中工程TARGETS工程名 - Build Phases - Compile Sources - 添加所缺失的类(.m)

编译链接报错Undefined symbols for architecture arm64: referenced from :_第2张图片

如果使用cocoapods引入了第三方类库,导致这个报错,可能是因为.a文件未找到导致的,需要在Link Binary With Libraries中引入缺失的三方库,步骤同上。

2. 将其引入进来,在使用命令 shift + command + k 清除一下缓存,在 command + b 重新编译即可。2

你可能感兴趣的:(iOS,iOS持续学习)