I was surprised by the lack of details on this topic so I decided to post my experiences with getting Evernote’s API setup in an iPhone application.
Note: Don’t forget to ask for an Evernote API key.
Steps for geting Evernote API compiling for the iPhone.
1. Grab thrift cocoa runtime:
$> svn co http://svn.apache.org/repos/asf/incubator/thrift/trunk/lib/cocoa/src/ thrift-cocoa
2. Grab latest Evernote API from http://www.evernote.com/about/developer/api
$> wget http://www.evernote.com/about/developer/api/evernote-api-1.xx.zip
3. Unzip Evernote API
$> unzip evernote-api-1.xx.zip
4. Go into the evernote cocoa source directory and replace every occurance of <Cocoa/Cocoa.h> with <UIKit/UIKit.h>
$> cd evernote-api-1.13/src/cocoa $> perl -pi -e 's/<Cocoa\/Cocoa.h>/<UIKit\/UIKit.h>/g' *.h $> perl -pi -e 's/<Cocoa\/Cocoa.h>/<UIKit\/UIKit.h>/g' *.m
5. Open XCode and add a ‘3rdParty’ group with the group “Evernote” beneath it
6. From the 3rdParty group click “Add existing files” and select the thrift-cocoa folder.
7. Expand the thrift-cocoa folder and delete the references to the folder server and everything contained within it.
Expand the transport folder and delete TSocketClient.m & TSocketClient.h (Evernote does not appear to need these and they won’t build with the iPhone SDK.)
9. From the “Evernote” group click “Add existing files” and select the cocoa folder under evernote-1.xx/src/cocoa
10. Try to build the system. I am using 1.13 and for whatever reason the cocoa is borked and needs some massaging. If you get errors like ‘EDAM_MIME_TYPES’ undeclared (first use in this function) then you have two choices. Install boost and thrift idl and run the thrift files in evernote-api-1.xx/src/thrift through thrift and it should generate good files otherwise you need to look at the errors and determine if you can fix them using some simple replacements as I have done below…
# Replaces the erroneous EDAM_ with EDAMEDAM_ $> perl -pi -e 's/ EDAM_/ EDAMEDAM_/g' EDAMLimits.m $> perl -pi -e 's/ EDAM_/ EDAMEDAM_/g' Types.m $> perl -pi -e 's/ EDAM_/ EDAMEDAM_/g' UserStore.m # But this breaks the function definitions so I refix them here. $> perl -pi -e 's/\+ \(int32_t\) EDAMEDAM_/\+ \(int32_t\) EDAM_/g' EDAMLimits.m $> perl -pi -e 's/\+ \(NSString \*\) EDAMEDAM_/\+ \(NSString \*\) EDAM_/g' EDAMLimits.m $> perl -pi -e 's/\+ \(NSSet \*\) EDAMEDAM_/\+ \(NSSet \*\) EDAM_/g' EDAMLimits.m $> perl -pi -e 's/\+ \(NSString \*\) EDAMEDAM_/\+ \(NSString \*\) EDAM_/g' Types.m $> perl -pi -e 's/\+ \(int16_t\) EDAMEDAM_/\+ \(int16_t\) EDAM_/g' UserStore.m
Your mileage will vary.
Pingback: Olive Tree and Notes Syncing | KevinPurcell.org
#1 by Jason Purdy on October 9, 2009 - 4:37 pm
Quote
Hello!
First off let me just say a big big thank you for posting this. This is the only tutorial I’ve found and your post has easily saved me 10s of hours. That being said I still can’t get it to compile. I’ve followed your steps and after getting tons of EDAM errors I’m not getting errors related to TProtocol. Any idea? I’ve posted some of my errors below. I’ve also included a screenshot of my setup and my info page where I added the links to the respective sources.
Thanks again and hope to hear from you soon!
Jason
Screenshot of my xcode: http://skitch.com/jasonpurdy/nnunk/project-iphone-white-info
/Users/jasonpurdy/Documents/branchesForWhite/iphone_white/20091001_1_2_submission/iphone_white/../evernote-api-1.13/src/cocoa/Errors.h:39: error: cannot find protocol declaration for ‘TProtocol’
/Users/jasonpurdy/Documents/branchesForWhite/iphone_white/20091001_1_2_submission/iphone_white/../evernote-api-1.13/src/cocoa/Errors.h:40: error: cannot find protocol declaration for ‘TProtocol’
/Users/jasonpurdy/Documents/branchesForWhite/iphone_white/20091001_1_2_submission/iphone_white/../evernote-api-1.13/src/cocoa/Errors.h:62: error: cannot find protocol declaration for ‘TProtocol’
/Users/jasonpurdy/Documents/branchesForWhite/iphone_white/20091001_1_2_submission/iphone_white/../evernote-api-1.13/src/cocoa/Errors.h:63: error: cannot find protocol declaration for ‘TProtocol’
/Users/jasonpurdy/Documents/branchesForWhite/iphone_white/20091001_1_2_submission/iphone_white/../evernote-api-1.13/src/cocoa/Errors.h:85: error: cannot find protocol declaration for ‘TProtocol’
/Users/jasonpurdy/Documents/branchesForWhite/iphone_white/20091001_1_2_submission/iphone_white/../evernote-api-1.13/src/cocoa/Errors.h:86: error: cannot find protocol declaration for ‘TProtocol’
/Users/jasonpurdy/Documents/branchesForWhite/iphone_white/20091001_1_2_submission/iphone_white/../evernote-api-1.13/src/cocoa/Errors.m:81: error: cannot find protocol declaration for ‘TProtocol’
#2 by Jason Purdy on October 9, 2009 - 4:42 pm
Quote
I also tried adding ../thrift-cocoa/transport to my header search paths. I’m guessing my issue is that i’m not addding these files correctly. What do you mean by “3rd party group”?
thanks again!
jason
#3 by Jason Purdy on October 10, 2009 - 11:54 am
Quote
aaaaaaaaahhhhhhhhhhhhhhhh. fixed it. had my settings for a certain config. Gonna try and implement your sample now!
#4 by Feiry on October 12, 2009 - 10:05 pm
Quote
Hi david,
Thank you for your great information. It really helps me a lot working on my rss reader (iNews for iPhone)
#5 by Edgar on April 13, 2010 - 3:16 am
Quote
Hello David!
Thanks a lot for this posting this information. It really helped me.
#6 by Siva on September 1, 2010 - 10:18 pm
Quote
Recursively adding it in “Header Search Path will resolve this issue, it seems.