问题描述:

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.

网友答案:

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"

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)

  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.

网友答案:

NOTHING LIKE ABOVE HELPED!!!!

This may help you, it solved my 'MailCore/MailCore.h' not found:

My project with MailCore2 would build just fine (so DEBUG mode is functioning just right), but when archiving it for AdHoc distribution (that uses RELEASE config) it would suddenly say 'MailCore/MailCore.h' not found!!! wth ikr.

I just went in derived data and found this path to the libraries and headers for the DEBUG config (BTW, both AdHoc and Release folders were there but empty!!!):

(you can get to that folder from Organizer\Projects\ choose you project and partial Derived Data path will be displayed, click on the right arrow to go to the folder in finder)

/Users/YOURUSERNAME/Library/Developer/XCode/DerivedData/YOURAPPNAME-SOMERANDOMLETTERS/Build/Products/Debug-iphoneos/

copied it and added (in both PROJECT and TARGETS Build Settings) to:

  1. Header Search Paths for my Archive Config (MAKE IT RECURSIVE)
  2. Library Search Paths for my Archive Config (MAKE IT RECURSIVE)

So find that path and add it to the config that you want and make it recursive.

Hope it helps somebody.

相关阅读:
Top