No declaration of the property 'pData' found in the interface-Objective C
How to declare an array of characters so that all the functions that has been defined inside the class can use it with the updated values.
Getting errors when defining the char data[4096] in the @synthesize definition.
@interface A: NSObject
{
char data[4096];
}
@property(nonatomic,retain)char data;
@end
@implementation A
@synthesize data
@end
I am getting "No declaration of the property 'pData' found i开发者_StackOverflown the interface"
Not sure why you get that error, but several things are clearly wrong in your code:
data
instance variable and property for it have different types. Property declaration should be@property(nonatomic) char[4096] data;
You must use retain attribute only for obj-c types properties, for plain c-types use assign (or don't specify anything as assign is used by default)
Exposing your pointer to char directly to changes may be not a good idea - better make your property readonly and make special method to change its contents:
@property(nonatomic, readonly) char[4096] data; - (void) changeData:...//some parameters here
P.S. May be consider using NSString*
(or NSMutableString*
) instead of char[]?
P.P.S. Or if you just store some random byte data consider using NSData/NSMutableData for that. (Thanks @bbum for suggesting that)
精彩评论