Search code examples
iosflickr

Single Flickr photo causes Absurd Capacity exception


I am trying to use the Flickr API to grab some random recent photos and something is triggering the following error consistently, regardless of how many images I try to grab. Here is the error:

2013-04-25 20:18:29.032[16774:907] url: http://www.flickr.com/photos/93782041@N02/8682749674/
2013-04-25 20:18:29.695[16774:340f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSConcreteMutableData initWithCapacity:]: absurd capacity: 4294967295, maximum size: 2147483648 bytes'

Here are the URL's I am using to hit Flickr's API:

@"http://api.flickr.com/services/rest/?method=flickr.photos.getRecent&api_key=49fc6b700469f9f797318998a948a9c1&per_page=1&format=json&nojsoncallback=1"

And that API call yields this URL:

http://www.flickr.com/photos/91031908@N05/8682765916/

Which opens in a browser just fine and doesn't seem to be that big! Does anyone have any ideas what might be happening here?


Solution

  • The issue is resolved but admittedly I do not fully understand the underlying issue. I was using the wrong URL format in the Flickr documentation, here: http://www.flickr.com/services/api/misc.urls.html

    I should have been using a photo source URL, which when I did, resolved the problem. The URL format I was using was the web page format, which I found in a different tutorial online. That one was not correct for grabbing photos in code.