ios开发问题:添加库和复制其它工程文件编译错误问题

首先添加库问题:

选择页签Build Phases->Link Binary With Libraries点+添加库


然后command+shift+k清除历史debug的垃圾

复制其它工程文件编译错误问题:

当拷贝文件到工程里的时候,若不注意勾选"Add to Target",运行时会报如下类似的错误:
Undefined symbols for architecture i386:
 
"_OBJC_CLASS_$_SKPSMTPMessage", referenced from:
  objc-class-ref in ConfirmController.o
 
"_kSKPSMTPPartContentTransferEncodingKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o
 
"_kSKPSMTPPartMessageKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o
 
"_kSKPSMTPPartContentTypeKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o
 
ld: symbol(s) not found for architecture i386
 
 
解决方法:
先点击方案(左边列表,点击方案的图示)
选择target
选择页签Build Phases
Compile Source
如果没展开的话先展开
向下找加号,点击加号,将这个target需要的.m档案的头文件都加入吧
(如果只有一个 就把左右的.h档案都加入)
这样就应该可以了


原文地址:https://www.cnblogs.com/snake-hand/p/3153262.html