I have an objective c class that has a NSString object with property like that :
@property (nonatomic,retain) NSString *data;
now, from a c function , i want to do : data=@"abc"; , but the c function does not see data .
How would i access data from a pure c function in that same class ? I have tried with creating an object of that class within the c function but it crashes.
EDIT :
I have also tried to call obj c function with argument , i can call the function but without the argument : (in the C function )
NSString *ran=@"";
[refToSelf postNotification:ran];
do that without passing ran is working. how would i pass ran ??
postNotification? is your C function defined inside of a.mfile?data = @"abc"; inside the class, either. You would be setting the property's instance variable directly, if it even has one by that name (which depends on several things). The way to set the property inside the class is eithermyObject.dataor[myObject setData:](which are equivalent to each other), which are also the ways you'd set the object's property from another class and how you'd set it from a C function. The key thing is that this is a property of some object, and you must have the object in hand in order to set a property of it.