MGTwitterEngine important update

To all those using my MGTwitterEngine code on either Mac OS X or iPhone OS, please update your code from the Subversion repository. Please note that you should always be using the repository; I’m not making any effort to keep static zip-files of the code up to date. If you don’t know how to get code from the repository, see the notes at the end of this post.

This version brings a few improvements and some fixes, as detailed below.

  • On August 1st, Twitter pushed out an update to the Twitter API to correct a security flaw in the service. This update was released with just 2 hours’ notice, and I’ve only now had a chance to make the corresponding updates in MGTwitterEngine. If you were getting HTTP 400 errors when using MGTwitterEngine to follow/unfollow people, set favorite tweets, delete tweets or direct messages, and a few other things, this new version fixes the issue. No code-changes on your part will be necessary.
  • Significantly, MGTwitterEngine now incorporates the various improvements from the Iconfactory’s Twitterrific client for iPhone (which uses MGTwitterEngine). One major improvement is that you can now optionally use LibXML instead of NSXMLParser (on either Mac OS or iPhone) for better XML-parsing performance. See the included README file for more information on that (notably you’ll have to add a path to your project’s Header Search Paths to avoid compilation errors).
  • We now support a new method to test whether a given user receives updates from a given other user (i.e. if user1 is “friends with” user2). The new method is -isUser:receivingUpdatesFor:.
  • We now support the new parameters in the methods to retrieve either friends or user timelines. Namely, you can now specify a starting page-number and/or a number of tweets to retrieve for either method, and you can also specify either an optional starting date or a specific starting tweet-ID. This will be useful for Twitter clients which maintain state (as yours should).

Many thanks to Craig Hockenberry (chockenberry on Twitter) for his great work on Twitterrific and for contributing his improvements back into the codebase for everyone’s benefit – even his competitors!

We both hope you’ll enjoy this new version of MGTwitterEngine on Mac OS X and iPhone.

How to get code from the Subversion repository

Just launch the Terminal application (it’s in /Applications/Utilities), paste the following command into the window (all on one line) and then press Return: svn checkout http://svn.cocoasourcecode.com/MGTwitterEngine ~/Desktop/MGTwitterEngine That command will checkout the latest copy of the source into a folder on your Desktop called “MGTwitterEngine”. The actual name of the folder is up to you, and you can then move that folder anywhere you like. Whenever you want to update to the latest version of the code thereafter, launch the Terminal application again and use the commands below. Note that there are two commands, and that they should be pasted into Terminal one at a time, pressing Return after each. Also note that you should obviously change the first command to use the actual path to wherever you’re keeping the code. cd ~/Desktop/MGTwitterEngine svn update If you want to find out more about Subversion, you can read the free online Subversion book.

6 comments

  1. Hi, this caught me out after updating to the newest version.

    While the readme implies that using LibXML is optional it appears that the lib needs to be added as an “other framework” for compilation regardless of what USE_LIBXML is set to.

    On a project with all the the required MGTwitter* files imported and with USE_LIBXML set to 0 there are 20 compilation errors (4 real, repeated 5 times each)

    Line Location MGTwitterLibXMLParser.h:16: error: libxml/xmlreader.h: No such file or directory
    Line Location MGTwitterLibXMLParser.h:29: error: syntax error before ‘xmlTextReaderPtr’
    Line Location MGTwitterLibXMLParser.h:42: error: syntax error before ‘xmlChar’
    Line Location MGTwitterLibXMLParser.h:43: fatal error: method definition not in @implementation context

    Adding the framework and the header search path makes the errors go away.

    One last thing, curious as to why you say to add /usr/lib/libxml2.dylib & not the SDK version /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libxml2.2.dylib to the project if you are working on a Mac version.

    Many thanks for your continued work on this source code.

    Rob

  2. I added both the framework and the search path and get the same errors – 43 of them (some duplicates of course). I’ll try to figure out what the heck might be wrong…

  3. I was also getting 43 build errors but resolved it.

    The problem I was having was that I added the libxml2 path to the ‘user header search paths’ field instead of ‘header search paths’. Hope this helps somebody else.

    Thanks again Matt for putting this API together for us.

  4. Hey Matt, great job with the Twitter engine!
    I just played with it for couple of days,
    but to me it seems in libxml mode there are too much leaks.

    I did simple, login to twitter and grabbing the last 5 updates from my friends, and when I start the app with leaks, it shows me about 30 objects leaked from libxml2.2.dylib

    Did you try this ?

    Thanks for the great library,
    Marin Todorov

  5. I am trying to use home_timeline method to get tweets and its working perfect except one thing that it gives ID same for each tweets. but when i use yajl parser for json format it gives proper id for each tweet. Has anyone happened to get this kind of problem. can anyone tell me how to get the proper id using libxml?

  6. I’m such a newbie, but I don’t understand how to add the libxml2.dylib to the header search path. What path exactly should I add? I keep getting the errors on the import and am soo frustrated Any help would be greatly appreciated.

Leave a comment