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 7521299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:12:46+00:00 2026-05-30T02:12:46+00:00

.h @property (nonatomic,assign) BOOL dontSendDelegate; .m @synthesize dontSendDelegate; – (id) initWithSession:(AVCaptureSession *)aSession outputFileURL:(NSURL *)anOutputFileURL

  • 0

.h

@property (nonatomic,assign) BOOL dontSendDelegate;

.m

@synthesize dontSendDelegate;

- (id) initWithSession:(AVCaptureSession *)aSession outputFileURL:(NSURL 
*)anOutputFileURL
{
    self = [super init];
    if (self != nil) 
    {
        self.dontSendDelegate = NO;
    }
return self;
}


if (self.dontSendDelegate == YES)
{
    NSLog(@"YES");
}
else
{
    NSLog(@"NO");
}

Thats all my code in that class relating to the BOOL.

It always prints YES.

What is it that I’m not understanding? I expect it to always print NO.

EDIT

Used Xcode to search ‘dontSendDelegate’

It only appears in the code I’ve shown. Which is copy and paste.

Changed it to an int and assigned 0 instead of the ‘NO’ and did the comparison == 1 instead of == YES and it works as you would expect. But I’m still lost as to why BOOL was not working.

Thanks for all the help and discussion about the problem.

  • 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-30T02:12:47+00:00Added an answer on May 30, 2026 at 2:12 am

    When you put the mutable part of an expression (your bool instance variable) before a comparison operator such as ==, sometimes you have a typo where you write = instead, so you set the variable instead of compare it. Look for errors of this type.

    Or always put the immutable value first, so in the code you have provided so far you would instead write

    if (YES == self.dontSendDelegate)
    

    That way, if you ever type one equal sign instead of two, the compiler will complain.

    (from comments) When testing boolean variables, you don’t need to use == at all. Just use if (self.dontSendDelegate) or if (!self.dontSendDelegate).

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

Sidebar

Related Questions

Apple recommends to declare a BOOL property this way: @property (nonatomic, assign, getter=isWorking) BOOL
Example: @property (nonatomic, assign) BOOL running; -valueForKey returns an id according to the documentation.
I've been reading that if I have something like this: @property (nonatomic, assign) UIView
NSString *statusValue; NSString *currentValue; @property(retain, nonatomic) NSString *statusValue; @property(retain, nonatomic) NSString *currentValue; @synthesize statusValue;
For example, I have properties like this: @property (nonatomic, assign) CGFloat startValue; @property (nonatomic,
What does nonatomic mean in this code? @property(nonatomic, retain) UITextField *theUsersName; What is the
If I define an property and just do: @property(nonatomic) UIButton* button; then I think
Do I have this right ... // Reactor.h @property(nonatomic, retain) NSMutableArray *reactorCore; // Reactor.m
This code works: monkey.h @interface monkey : NSObject { NSNumber *monkeyRanch; } @property (nonatomic,
DetailViewController.h @interface DetailViewController : UIViewController { NSInteger getInteger; NSNumber *getNumber; } @property (nonatomic, retain)

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.