devedup/FlickrKit — pull request #21 by JamesBucanek (2014-05-29 00:02:23+00:00)
Title: Restore permissionGranted during -checkAuthorizationOnCompletion:

I tracked down what I thought was a Flickr problem to a bug in FlickrKit. It turns out that FlickrKit sets the permissionGranted property during -beginAuthWithCallbackURL:permission:completion:, but it doesn’t not preserve it in user defaults nor does it restore it during -checkAuthorizationOnCompletion:.

The end result is that permissionGranted eventually gets reset back to FKPermissionRead and then any of the model-based methods (specifically not “upload”) that require WRITE or DELETE access fail when called. (See -[FlickrKit call:maxCacheAge:completion:]).

Ultimately, I decided to refresh the permissionsGranted property from the value returned from the flickr.auth.checkToken call, rather than simply storing it in user defaults, simply because it could (in theory) have changed on Flickr’s end, and this will keep it up-to-date.

This pull request also includes the patch by lysannschlegel that fixes the problem with the NSLocalizedDescriptionKey in the NSError userInfo dictionary. Mostly because (a) I’m tired of reapplying this patch after every new FlickrKit update and (b) I have no idea how to separate this fix from my pull request. :(