TheProjecter / objectiveflickr

Automatically exported from code.google.com/p/objectiveflickr
Other
0 stars 0 forks source link

When calling flickr.activity.userPhotos, if only one activity event is returned for a photo, sometimes it is in an array and sometimes not. #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I make the following calls to retrieve my activity...

[invoc setUserInfo:@"getActivity"];
[invoc callMethod:@"flickr.activity.userPhotos" arguments:[NSArray
arrayWithObjects:@"auth", [NSNull null], nil]]; 

What is the expected output? What do you see instead?

What I am seeing is the first photo's activity looks like this :

                activity =                 {
                    event =                     (
                                                {
                            "_dateadded" = 1209347089;
                            "_type" = fave;
                            "_user" = "14317588@N05";
                            "_username" = theskywatcher;
                        }
                    );
                };

Here the single event is in an array of one element. That's fine, and what
I'd expect really. However the next photo's activity looks like this...

                activity =                 {
                    event =                     {
                        "_dateadded" = 1209347133;
                        "_type" = fave;
                        "_user" = "14317588@N05";
                        "_username" = theskywatcher;
                    };
                };

Still only one event but this time it isn't in an array. I'm new to the
API, so my apologies if I'm flagging something that is perfectly normal,
but I just thought it was a little inconsistent.

What version of the product are you using? On what operating system?
ObjectiveFlickr 0.9.5 on OS X 10.5.2

Please provide any additional information below.

Original issue reported on code.google.com by Anton.Je...@gmail.com on 28 Apr 2008 at 8:57

GoogleCodeExporter commented 9 years ago
It's some dotty part of Flickr API. It might not be practical to produce an 
exhaustive list of such tags. 
Fortunately, we can make use of Objective-C's dynamic nature to determine if 
the enclose element is an array 
or not. And the number of such APIs are not that many.

Please take a look at 
http://github.com/lukhnos/objectiveflickr/tree/master/README.markdown and in 
particular the "Wacky XML Mappings" section, which addresses exactly the 
problem. After thinking about this 
for a while, I decide to give up making a list of exceptions. Although the 
document is about ObjectiveFlickr 2, 
the workaround still applies to ObjectiveFlickr 0.9.x and all such XML mapping 
problems in general.

Original comment by lukh...@gmail.com on 15 Apr 2009 at 5:15