error: property 'myBoolVariableName' with 'retain' attribute must be of object type


error: property 'myBoolVariableName' with 'retain' attribute must be of object type



I have a BOOL value inside my @interface definition in my .h file. Here it is below. It has the same problem whether it's a pointer or not.

@interface myCustomViewController : UIViewController <UIWebViewDelegate> { {  //...more iboutlets defined above  BOOL *myBoolVariableName; } 

When I compile, I get "error: property 'myBoolVariableName' with 'retain' attribute must be of object type" on the line for the import of my .h file.

I found this page here about an integer / nsnumber:

http://discussions.apple.com/thread.jspa?threadID=1846927

So, it seems I can't use BOOL values inside an @interface definition. What can I use instead?

What should I do for BOOL / boolean values?


How to lose margin/padding in UITextView?

1:

Creating a PHP Webservice with binary-encoded parameters?
I'm guessing this later in your interface you have any thing like this:. Is there an iPhone SDK API for twitter? [closed]
@property (retain) BOOL *myBoolVariableName; 
That means make a property who's value is a pointer to a BOOL, and use retain semantics.. iPhone Safari: Scroll a list inside a html container Your problem is this BOOL * is a pointer to a byte of memory, not a pointer to an object. iphone: making a new UIImage from data from an XML documentAnd retain is any thing this applies only to objects.. What's the best way of learning iPhone programming when coming from Java? Here's how you must make a BOOL property.. -didSelectRowAtIndexPath: not being called
@interface myCustomViewController : UIViewController <UIWebViewDelegate> {     BOOL myBoolVariableName; }  @property myBoolVariableName;  @end 
The important differences are this the variable is declared as "BOOL", not "BOOL *" and the property doesn't have (retain).. Why do I have to clean up memory if I have an IBOutlet with “retain”, but not when I have one with “assign”?

2:

I have faced similar situation. I solved it like,.
@interface myCustomViewController : UIViewController { BOOL myBoolVariableName; } @property BOOL myBoolVariableName; @end 
I refer one answer by Jon Hess although I got one error in it. Type name requires a specifier or qualifier. My previous version was like,.
@property myBoolVariableName; 
So I added BOOL and solved the issue..


90 out of 100 based on 35 user ratings 350 reviews