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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:24:25+00:00 2026-05-13T12:24:25+00:00

I have an Application Delegate class with a enumeration which looks like this: typedef

  • 0

I have an Application Delegate class with a enumeration which looks like this:

typedef enum {
    Online = 3500,
    DoNotDisturb = 9500,
    Offline = 18500,
    Away = 15500,
    Busy = 6500,
    BeRightBack = 12500
} status;

Additionally I have a property to set a value from the enumerator in my interface file:

@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
    status userStatus;
}

@property (nonatomic, setter=setStatus) status userStatus;

@end

Finally I have the following message in my implementation file:

@implementation Communicator2AppDelegate

- (void)setStatus:(status)_userStatus {
    if ([NSThread isMainThread]) {
        // some stuff happens here ...
    } else {
        [self performSelectorOnMainThread:@selector(setStatus:) withObject:_userStatus waitUntilDone:NO];
    }
}

My issue is the following: the performSelectorOnMainThread message isn’t working because it doesn’t accept ‘_userStatus’ as a value. My guess is the message assumes it’s an enum, not a real value. I get the following error message upon compilation: “Incompatible type for argument 2 of ‘performSelectorOnMainThread:withObject:waitUntilDone.'”

Does anyone have any idea on how to make this work?

  • 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-13T12:24:25+00:00Added an answer on May 13, 2026 at 12:24 pm

    You need to pass an object value to this method and enum (that is int) is scalar value. To achieve what you need you must wrap your integer to obj-c object (e.g. NSNumber):

    - (void)setStatus:(status)_userStatus {
        if ([NSThread isMainThread]) {
            // some stuff happens here ...
        } else {
            [self performSelectorOnMainThread:@selector(setStatus:) withObject:[NSNumber numberWithInt:_userStatus] waitUntilDone:NO];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my main application delegate which contains a method that returns an object.
I have this simple code in a WPF application: ThreadStart start = delegate() {
In my application delegate I have an NSString which can be modified by a
I have a class in my application which handles all the controls and all
I want to create a class to speed up things like getting application delegate,
I have two string properties setup in my cocoa application's app delegate which are
I have two view controller classes in my application delegate. I can change from
I'm writing a Cocoa application where I have an auto generated app delegate:(MyAppDelegate.h/MyAppDelegate.m) So
I have application which uses Sherlock ActionBar package. The application uses platform-specific behavior for
I have application with needs to have access to some sensitive data(in this case

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.