ios 在iPhone中发送电子邮件时出错

bxjv4tth  于 2023-03-09  发布在  iOS
关注(0)|答案(2)|浏览(356)

我尝试创建发送电子邮件的应用程序我使用了SKPSMTPMessage,NSStream+SKPSMTPExtensions,NSData+Base64Additions,HSK_CFUtilities,Base64Transcoder等类,但它给我以下错误

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKPSMTPMessage", referenced from:
  objc-class-ref in MFViewController.o
"_kSKPSMTPPartContentTransferEncodingKey", referenced from:
  -[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartContentTypeKey", referenced from:
  -[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartMessageKey", referenced from:
  -[MFViewController sendMail:] in MFViewController.o
"_CFHostCreateWithName", referenced from:
  +[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in    NSStream+SKPSMTPExtensions.o
  +[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in  SKPSMTPMessage.o
"_CFStreamCreatePairWithSocketToCFHost", referenced from:
  +[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in NSStream+SKPSMTPExtensions.o
  +[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in SKPSMTPMessage.o
 ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

请记住,我使用的是Xcode 4.3,我应该怎么做来解决这个问题??
添加CFNetwork框架和SystemConfiguration框架后,错误数从6个减少到4个,现在是

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKPSMTPMessage", referenced from:
  objc-class-ref in MFViewController.o
"_kSKPSMTPPartContentTransferEncodingKey", referenced from:
  -[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartContentTypeKey", referenced from:
  -[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartMessageKey", referenced from:
  -[MFViewController sendMail:] in MFViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
flmtquvp

flmtquvp1#

尝试添加以下链接器标志:

OTHER_LDFLAGS = -lz -lxml2 -ltidy -ObjC
3xiyfsfu

3xiyfsfu2#

此错误消息意味着这些类搜索框架中的某些对象,而这些对象尚未链接到您的项目。Here您可以找到您需要的框架:CFNetwork框架。

编辑

其他4个错误可能是由于SKPSMT类的导入不正确造成的。如果该类是作为库下载的,您还需要将应用与该库链接。

相关问题