How to distinguish different requests in didCompleteWithResponse:

45 views
Skip to first unread message

Michael Valentiner

unread,
Feb 21, 2012, 9:09:07 AM2/21/12
to objectiveflickr
Hi,

I am writing a class that issues several different requests to flickr
using callAPIMethodWithGET:. In my OFFlickrAPIRequestDelegate
didCompleteWithResponse: method, how can I tell which request it is
getting called for? For example, my class requests,
flickr.contacts.getList and flickr.galleries.getList. When
didCompleteWithResponse: is called, how can I know which response I am
handling?

Is there something in the OFFlickrAPIRequest that I can access that
would tell me the method that was requested, flickr.contacts.getList
or flickr.galleries.getList? I don't see anything obvious.

luk...@gmail.com

unread,
Feb 23, 2012, 6:20:52 AM2/23/12
to objecti...@googlegroups.com
You can use the sessionInfo property for that purpose. For example, just set sessionInfo to @"flickr.contacts.getList" (or some custom objects if you need more information to be carried with each request issued), and in your delegate method -flickrAPIRequest:didCompleteWithResponse:, just fetch the request.sessionInfo to check which API you are calling.

Another possible approach is to create different request objects for different methods. Then you can just use pointer comparison to see if request == theRequestThatIJustCalled.

Lukhnos

Michael Valentiner

unread,
Feb 23, 2012, 9:20:20 PM2/23/12
to objecti...@googlegroups.com
Lukhnos,

Thank you for your reply. I looked at sessionInfo, but it appears it is used sometimes. Looking closer, it appears it is only used during authentication, so I guess I can use it without worrying about clobbering other data.

----------------------------------------------------
Michael Valentiner, Minneapolis, MN
michael.v...@gmail.com

> --
> You received this message because you are subscribed to the Google Groups "objectiveflickr" group.
> To post to this group, send email to objecti...@googlegroups.com.
> To unsubscribe from this group, send email to objectiveflic...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/objectiveflickr?hl=en.
>

Reply all
Reply to author
Forward
0 new messages