Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 350791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:34:58+00:00 2026-05-12T11:34:58+00:00

I have a BOOL value inside my @interface definition in my .h file. Here

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:34:59+00:00Added an answer on May 12, 2026 at 11:34 am

    I’m guessing that later in your interface you have something like this:

    @property (retain) BOOL *myBoolVariableName;
    

    That means make a property who’s value is a pointer to a BOOL, and use retain semantics.

    Your problem is that BOOL * is a pointer to a byte of memory, not a pointer to an object. And retain is something that applies only to objects.

    Here’s how you can make a BOOL property.

    @interface myCustomViewController : UIViewController <UIWebViewDelegate> {
        BOOL myBoolVariableName;
    }
    
    @property myBoolVariableName;
    
    @end
    

    The important differences are that the variable is declared as “BOOL”, not “BOOL *” and the property doesn’t have (retain).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bool value that I need to display as Yes or No
I have an app where I need a BOOL value to persist across launches.
Suppose we have: interface Foo { bool Func(int x); } class Bar: Foo {
Whenever I have to use a BOOL flag which maintains its value across multiple
Inside my Table view controller I have following method -(BOOL)isValidCoordinate:(CLLocationCoordinate2D)coordinate { //This is just
I have an bool property in a class. And using <%= Html.EditorForModel() %> its
I have a boolean (BOOL) type field in the SQLite table. In the SubSonic
I have a nullable bool. What is a quick way to invert it. In
Let's say I have a method: bool myMethod(int a) { //return a bool }
Lets say we have this code: bool KeepGoing = true; DataInThread = new Thread(new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.