is it possible to pass array as obj via nsnotification

You should use userInfo. It is for misc data you want to send with the notification. The object argument is for the object that the event is fired for. For example, if you want to monitor a certain MPMoviePlayerController (but not others), then you would sign up for only its notifications (via the object argument).


An NSNotification has a property called userInfo that is an NSDictionary. The object is the NSObject that is posting the NSNotification. So usually I use self for the object when I'm setting up the NSNotification because self is the NSObject sending the NSNotification. If you wish to pass an NSArray using an NSNotification I would do the following:

NSArray *myArray = ....;
NSDictionary *theInfo =
  [NSDictionary dictionaryWithObjectsAndKeys:myArray,@"myArray", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadData"
                                                    object:self
                                                  userInfo:theInfo];

And then catch it using the following:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(doTheReload:)
                                             name:@"reloadData"
                                           object:sendingObject];

where sendingObject is the object that is sending the NSNotification.

Finally, decode the array in doTheReload: using:

NSArray  *theArray = [[notification userInfo] objectForKey:@"myArray"];

That always works for me. Good luck!