Search code examples
iosobjective-cxcodemailcore2

<MailCore/MailCore.h> File Not Found


I am having an issue with adding the mailcore 2 header file into my xCode project. I have followed all of the steps from their website:

For iOS - If you're targeting iOS, you have to link against MailCore 2 as a static library:
Add libMailCore-ios.a
Add CFNetwork.framework
Add Security.framework
Set 'Other Linker Flags': -lctemplate-ios -letpan-ios -lxml2 -lsasl2 -liconv -ltidy -lz -lc++ -stdlib=libc++ -ObjC
Make sure to use LLVM C++ standard library. Open Build Settings, scroll down to 'C++ Standard Library', and select libc++.
In Build Phases, add a Target Dependency of static mailcore2 ios.

I added the 'mailcore2.xcodeproj' xCode project from the cloned 'build-mac' mailcore2 folder on my desktop. In build phases, I added 'static mailcore2 ios (mailer2) to the target dependencies under the build phases section in xCode. In the 'Link with binary libraries' section, I added 'Security.Framework', 'CFNetwork.framework', and 'libMailCore-ios.a'. Finally, in Build Settings, I added the 'other linker flags' -lctemplate-ios -letpan-ios -lxml2 -lsasl2 -liconv -ltidy -lz -lc++ -stdlib=libc++ -ObjC

and I since the project already used the standard c++ library of 'libc++', I just left it that way.

I entered my the following into my ViewController.h: and I got the error shown below:

'MailCore/MailCore.h' file not found.

I have been trying to find a solution for days now, but I have come up with no solution. Any help would be greatly appreciated. Thanks in advance to all who reply.

***BTW: I am using the language 'Objective-C' for this project. I have trouble-shooted with the issues page on github, as well as MailCore's main website. All of the 'solutions' didn't fix the xCode error I was presented with.


Solution

  • Sounds to me like you're missing including 'MailCore' in your Targets 'Header Search Path' Build Setting.

    According to https://github.com/MailCore/MailCore, you need to

    Under your app’s target, switch to Build Settings. Locate “Header Search Paths” in the Build Settings and add "$(BUILT_PRODUCTS_DIR)/../../include"

    'Header Search Path' Build Setting

    You can set this by doing the following:

    1. Find out the path on disk to your the the 'MailCore' library headers
    2. Select your Target, then the 'Build Settings' tab and scroll down to 'Header Search Path'
    3. Double tap the existing value test (or blank entry if none)

    Editing Header Search Path

    1. When the Window appears, click the '+' to add a new line, then enter "$(BUILT_PRODUCTS_DIR)/../../include" (in double quotes).
    2. Change the second column from 'non-recursive' to 'recursive' to ensure Xcode will search recursively for headers.

    Then compile your app and you should hopefully see that the header is now found.