The Evernote SDK for iOS Quick-start Guide

The purpose of this guide is describing how to download, install and configure the Evernote iOS SDK to work with your iOS application. If all goes well, this should take 10 minutes or less.


  • 1. What you need

    Before we begin, make sure you have all of the following:

    1. An account on sandbox.evernote.com, Evernote’s development server. Your application will be communicating with this server during development. If you don’t have a testing account, create one here.
    2. An Evernote API key, which consists of a Consumer Key and a Consumer Secret. If you don’t have an API key yet, you can request one by clicking the green button at the top of this page.
    3. The latest version of Xcode (4.6.2 at the time of this writing) running on an Intel Mac.
    4. An Xcode project where you can install the SDK. If you don’t have one or aren’t sure how to create one, you can read instructions on creating one.

    Additional Notes:

    • If your project does not use ARC, you'll need to set the -fobjc-arc compiler flag on all of the files in the Evernote SDK.
  • 2. Downloading and installing the SDK

    All of our SDKs are hosted with Github. Browse to the Evernote iOS SDK, click “Downloads” and choose “Download as zip” or “Download as tar.gz” (whichever you prefer). If you're comfortable using the Git version control system, you may also clone the SDK to your local machine using the git clone command.

    Once you have the SDK archive downloaded, there are a few ways to add it to your project:

    • Extract the download archive. It will contain a folder called evernote-sdk-ios. Drag this folder into your Xcode project and drop it on the main project directory. It should look something like this when you’re finished:
    • Add evernote-sdk-ios.xcodeproj to your project/workspace.
    • Build evernote-sdk-ios as a static library and include the header (.h) and archive (.a) files.
    • Use the cocoapods dependency manager for Objective C, where our pod is called "Evernote-SDK-iOS".
  • 3. Configuring the SDK, OAuth, and other modifications

    The Evernote SDK for iOS communicates with the Evernote Cloud API using the OAuth protocol. The plumbing of OAuth is baked into the SDK, so we just need to configure our API key.

    In your application's main app delegate, locate the didFinishLaunchingWithOptions method. Near the end of this method (but before return YES;), add the following code:

    EVERNOTE_HOST is the server to which your app will be connecting. BootstrapServerBaseURLStringSandbox is a constant defined in ENConstants.h representing our development server. This host should be used while your app is being built. When you're ready to release your app, you'll need to get your API key activated on production and change EVERNOTE_HOST to either BootstrapServerBaseURLStringUS (for the production Evernote service) or BootstrapServerBaseURLStringCN (for Yinxiang Biji, Evernote's Chinese service).

    After adding those lines of code, replace your-key and your-secret with the Consumer Key and Consumer Secret from your API key.

    The last lines of this snippet configure the EvernoteSession singleton object. Whenever your application needs to access the Evernote Cloud API, you'll use this instance (more on that in a second).

    Don't forget to include the EvernoteSession.h and ENConstants.h header files. Add these lines just below the other #import statements near the top of your source file:

    Two more modifcations need to be made to your main app delegate before your application will function properly. First, modify the application:openURL:sourceApplication:annotation: method to look like this:

    Second, modify your application's applicationDidBecomeActive: method to include a call to EvernoteSession's handleDidBecomeActive method:

  • 4. Updating your application’s plist file

    Create an array key called URL types with a single array sub-item called URL Schemes. Give this a single item with your consumer key prefixed with en-:

    Your app's plist file can be found within the Support Files folder in your project. Right-click the file and choose Open As, then Source Code to edit it as XML. Feel free to add the XML near the top of the file (or wherever you'd like). Once you've finished, it should look like this:

    Screenshot%201/14/13%201:36%20PM
  • 5. Including Apple frameworks and modify header search path

    The Evernote SDK for iOS allows users of applications integrating with Evernote to install Evernote for iOS from within the integrated application. This functionality requires the StoreKit.framework package provided by Apple.

    Additionally, for our OAuth implementation to work correctly, we need to include Apple’s Security.framework package in our application’s build process.

    Finally, Evernote's XML writing and parsing facilities require the inclusion of MobileCoreServices.framework and libxml2.dylib.

    We need to add all of these frameworks to your application's build phase:

    Select your main project in the document browser on the left-hand side of Xcode. In the right-hand pane, choose “Build Phases”, then expand the “Link Binary with Libraries” row below. Click the + to add a new library.

    This will bring up the library browser dialog. In the search field at the top, begin typing “Security” until Security.framework is visible. Click Security.framework, then click “Add”. Repeat these steps for StoreKit.framework, MobileCoreServices.framework and libxml2.dylib.

    Additionally, you'll need to modify the Header Search Paths in your application's Build Settings. Set the value to ${SDKROOT}/usr/include/libxml2, leaving the non-recursive option unchanged.

    We’re now ready to test our application’s ability to authenticate via OAuth. Let’s do that now.

  • 6. Testing OAuth

    Before we continue, we should make sure everything is working as it should. Let’s create a very simple test that will authenticate with the Evernote Cloud API via OAuth and successfully make an API call (UserStore.getUser, in this case).

    (Note: the following implementation is meant to be an example that a new user can quickly build and run to make sure things are working. How you structure your application, etc. is up to you.)

    We’re going to create a single button that does everything. It won’t be pretty, but it will let us know we’ve got everything wired up correctly.

    Open your app’s main UIViewController header file and add these two lines:

    Click over to your application’s .xib file and drag a single Round Rect Button onto the canvas. You can change the button text if you like, but you don’t need to for this exercise. After you’ve placed the button, click on “File’s Owner” under Placeholders on the left, then hold the Ctrl key while you drag onto the button. When you release, you’ll see a list of outlets for that button. Select testButton from the list.

    Next, click the button on the canvas and drag it onto “First Responder” under Placeholders while holding the Ctrl key. When you release, a menu titled “Send Events” will appear. Click testEvernoteAuth.

    Open your application’s UIViewController implementation file (the .m file). In that file, just above @end at the bottom of the file, add this code:

    Finally, at the top of the same file, add #import statements for EvernoteSession.h and EvernoteUserStore.h (as well as the header file for your main application delegate):

  • 7. The acid test

    Assuming everything is in order, you should now be able to build your application and see a single button. When you click (or tap) that button for the first time, you’ll be taken to Evernote’s Web UI to authorize our test app to access your account. Once you enter the correct account credentials and click Authorize, the Web view will disappear and the Output area of Xcode should tell you something like this:

  • 8. In conclusion

    As previously stated, this guide is designed to get you quickly up and running with the Evernote SDK for iOS. Essentially, everything in the “Testing OAuth” section can be removed from your application and you’ll still be able to make calls to the Evernote Cloud API.

    Congratulations - you're on your way to building another fantastic integration with Evernote!

    If Something Goes Wrong

    If you follow the above instructions and you’re not able to produce the desired result, head over to our support page.

Stay on top of what's happening in the Evernote developer community.