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:

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 do I detect when the iPhone goes into landscape mode via JavaScript? Is there an event for this?


Java RSA decryption did not work for the data decrypted with its public key in IPhone
I'm guessing this later in your interface you have any thing like this:. Having trouble adding objects to NSMutableArray in Objective C
@property (retain) BOOL *myBoolVariableName; 
That means make a property who's value is a pointer to a BOOL, and use retain semantics.. How can I rotate an UIImageView by 20 degrees? Your problem is this BOOL * is a pointer to a byte of memory, not a pointer to an object. Replacing a document body on the iPhoneAnd retain is any thing this applies only to objects.. iPhone App: How to get data from an API, parse, and store for later use? Here's how you must make a BOOL property.. xcode gives syntax error on cpp code
@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).. Generate Xml


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..

70 out of 100 based on 10 user ratings 450 reviews