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

时间:2012-05-03 17:34:47

标签: iphone objective-c ios ipad

我正在尝试创建发送电子邮件的应用程序 我用的是类 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)

2 个答案:

答案 0 :(得分:0)

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

我希望它有所帮助!

修改

其他4个错误可能是由于错误输入SKPSMT类引起的。如果将这些类作为库下载,您还需要将您的应用程序与该库链接。

答案 1 :(得分:0)

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

OTHER_LDFLAGS = -lz -lxml2 -ltidy -ObjC