Question: I have a query of this type:

```
    Select addMovies.MovieName, GivenBy.UserName, TimeOfReview, Review 
    FROM Users, Reviews, given, addMovies 
    WHERE Reviews.ReviewId = given.ReviewId AND GivenBy.UserName = addMovies.UserName
    ORDER BY TimeOfReview DESC

```

Where schemas of individual tables are of the form

```
   Users (UserName, Password, EmailId, Loc, Info)
   Reviews (ReviewId, ReviewRating, Review)
   Given (ReviewId, UserName)
   addMovies (MovieName, UserName)

```

I am trying to obtain reviews given by a particular user, but its giving me the errors:

**The multi-part identifier "GivenBy.UserName" could not be bound.**

**The multi-part identifier "GivenBy.UserName" could not be bound.**

Could anyone please let me know whats wrong, and what could I do to correct this?

Answer: 
`objc_setAssociatedObject` adds a key value store to each Objective-C object. It lets you store additional state for the object, not reflected in its instance variables.

It's really convenient when you want to store things belonging to an object outside of the main implementation. One of the main use cases is in categories where you cannot add instance variables. Here you use `objc_setAssociatedObject` to attach your additional variables to the `self` object.

When using the right association policy your objects will be released when the main object is deallocated.
To answer your revised question:

> 
> What is the point in associating the device with the view controller if it's already an instance variable?
> 
> 
> 

There are several reasons why you might want to do this. 

* the Device class doesn't have a controller instance variable, or property and you can't change it or subclass it e.g. you don't have the source code.
* you want two controllers associated with the device object and you can't change the device class or subclass it.

Personally, I think it is very rare to need to use low level Objective-C runtime functions. This looks like a code smell to me.