Matt Gemmell

TOLL is available now!

An action-thriller novel — book 2 in the KESTREL series.

★★★★★ — Amazon

MGTwitterEngine and MGViewAnimation updated

development & source 2 min read

A couple of updates to some of my source code; details below. MGViewAnimation updated code is available via the source code page as usual and the latest MGTwitterEngine code is in the public Subversion repository at

(Please do get my code from the repository if it’s available there, because I don’t guarantee to update the zip files in a timely manner for code which is also in the repo, but the repo is always up to date. Thanks!)

MGViewAnimation was updated to properly deal with flipped views during animation - many thanks to Simon Ward for pointing out the problem and supplying the fix (Simon, if you want me to link your name here to a website, email me again with the URL).

MGTwitterEngine was updated to no longer delete your cookies by default when setting a username and password for the authenticating user. This used to be necessary, but is no longer so since we now don’t use NSHTTPCookieStorage for authentication. You can still enable the old behavior via a new accessor method if you need to, but things should hopefully be fine - and as a bonus, you now won’t have to login to Twitter again in Safari after running an MGTwitterEngine-using app. I’ve copied the relevant new section from MGTwitterEngine’s README.txt file below, which explains things in more detail.

About cookies Like most web sites/services, sets cookies on your computer when you authenticate with their server. These cookies (stored in NSHTTPCookieStorage) are shared amongst all applications which use NSURLConnection (including Safari and many more). MGTwitterEngine does not use those cookies, since it does its own direct authentication in the URLs of the requests it makes to the twitter servers. For this reason, as of version 1.0.4 (11th April 2008), it does not attempt to clear any saved cookies for when you set a username and password for MGTwitterEngine to use. However, previous versions of MGTwitterEngine did indeed clear twitter's cookies whenever you called the -setUsername:password: method, in order to avoid an old and now fixed possibility of using the wrong credentials for the next request. There are two outcomes from this: 1. MGTwitterEngine no longer clears your cookies, so for example you will now no longer have to re-login to Twitter in Safari after using an app which includes MGTwitterEngine. You would usually only have had to re-login with Safari once, but it was still an annoyance if you regularly used Twitter both on the web and with an MGTwitterEngine-using client. This should be fixed now. 2. In the unlikely event that you have any authentication problems when your MGTwitterEngine-using app switches from one Twitter account to another (for example, after switching accounts you still get data back from the old account, at least for the very first new request), you can easily re-enable the old cookie-clearing behaviour. Simply call the method -setClearsCookies: passing YES as the argument, and then call -setUsername:password: again, and all should be well.