无法获取SMTP代码进行编译

时间:2012-09-30 18:50:54

标签: objective-c ios smtp

我正在尝试编写一个iOS应用程序,在后台发送电子邮件,无需任何用户交互。我已经环顾了几天试图寻找一个简单的解决方案,但我找到的所有东西都很旧而且没有编译。目前,我尝试使用的库是:https://github.com/kailoa/iphone-smtp。但是,我无法编译它。

我所做的是将类文件拖到我的项目中,并将所有新类设置为不使用ARC。但是,我一直收到以下错误:

Ld /Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator/EmailTest2.app/EmailTest2 normal i386
    cd /Users/Andrew/Desktop/EmailTest2
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator -F/Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator -filelist /Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Intermediates/EmailTest2.build/Debug-iphonesimulator/EmailTest2.build/Objects-normal/i386/EmailTest2.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator/EmailTest2.app/EmailTest2


Undefined symbols for architecture i386:
  "_CFHostCreateWithName", referenced from:
      +[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in NSStream+SKPSMTPExtensions.o
  "_CFStreamCreatePairWithSocketToCFHost", referenced from:
      +[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in NSStream+SKPSMTPExtensions.o
  "_kCFStreamPropertySSLSettings", referenced from:
      -[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
  "_kCFStreamSSLAllowsAnyRoot", referenced from:
      -[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
  "_kCFStreamSSLAllowsExpiredCertificates", referenced from:
      -[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
  "_kCFStreamSSLAllowsExpiredRoots", referenced from:
      -[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
  "_kCFStreamSSLLevel", referenced from:
      -[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
  "_kCFStreamSSLValidatesCertificateChain", referenced from:
      -[SKPSMTPMessage parseBuffer] 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)

还有一个buildstaticlib.sh文件;但是,当我尝试使用命令./buildstaticlib.sh或其任何变体运行它时,它会给我这个错误:

Usage: ./buildstaticlib.sh PATH where PATH is the destination directory for the build package

如果您知道如何使用其他库在后台发送电子邮件,我将非常愿意切换。但是,我还需要帮助让该库运行。我已经尝试了至少6个不同的库,似乎无法在其中任何一个方面取得任何进展。谢谢!

1 个答案:

答案 0 :(得分:4)

您可能忘了添加框架。确保将所有导入的框架添加到项目中并由目标链接。

如果打开示例项目,您将看到使用了哪些框架:

enter image description here