I have a custom NSObject Class, lets call in People, and a Class from the CloudMade RMMarker.h called RMMarker. The RMMarker class has a property called data which is a NSObject. I know set the data by doing this:
People *aPeople = [[People alloc] init];
marker.data = aPeople;
How can I read the data which is stored in data? All I know is its not
People *aPeople = [[People alloc] init];
aPeople = marker.data;
What is the right way to do so?
Thanks
Philip
Since you know that
marker.datais of typePeople *, you can simply cast it to the correct type:Note that this will only work properly if
marker.datais actually aPeople *object (or one of its subclasses). To be sure, you can add an assertion test:For important details regarding the use of NSAssert(), please read: What are assertions or NSAssert good for in practice?