I’m trying to write an iOS app that sends in an e-mail in the background without any user interaction. I’ve looked around the internet for days trying to find a simple solution, but everything that I find is really old and doesn’t compile. Currently, the library that I am trying to use is: https://github.com/kailoa/iphone-smtp. However, I can’t get it to compile.
What I have done is dragged the classes file into my project and set all of the new classes to not use ARC. However, I keep getting the following error:
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)
There is also a buildstaticlib.sh file; however, when I try to run it using the command ./buildstaticlib.sh or any variant of it, it gives me this error:
Usage: ./buildstaticlib.sh PATH
where PATH is the destination directory for the build package
If you know how to send an e-mail in the background using some other library I would be more than willing to switch. However, I would need help getting that library to run also. I’ve tried at least 6 different libraries and can’t seem to make any progress with any of them. Thanks!
You probably forgot to add a framework. Make sure, all the imported frameworks are added to your project and linked to by your target.
If you open the sample project you’ll see what frameworks are used: