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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:12:24+00:00 2026-05-28T01:12:24+00:00

In my AppDelegate, I have #import <UIKit/UIKit.h> #import CustomerProfile.h @interface AppDelegate : UIResponder <UIApplicationDelegate>

  • 0

In my AppDelegate, I have

#import <UIKit/UIKit.h>
#import "CustomerProfile.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property   (strong, nonatomic) UIWindow *window;
@property   (strong, nonatomic) int x;

@end

At class B, I do

AppDelegate *appDelegate        =   [[UIApplication  sharedApplication] delegate];
appDelegate.x   =   5;

Then at Class C, I do

 AppDelegate *appDelegate        =   [[UIApplication  sharedApplication] delegate];
 appDelegate.x   =   4;

Eventually, at class D I print out the result of x and x = 5. Should x be 4.
It is confusing me. Please advice me on this issue.
Thanks

  • 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-28T01:12:25+00:00Added an answer on May 28, 2026 at 1:12 am

    In your App delegate method your property x is set to strong (aka retain), you have to set to assign, a int var can’t be retained because its not a object:

    @property (assign, nonatomic, readwrite) int x; //then @synthesize in the implementation
    

    Second, you have to import the header of your appDelegate (in your B,C,D Classes)

    #import "yourAppDelegate.h" 
    

    set your appDelegate instance:

    yourAppDelegate *appDelegate = [[UIApplication sharedApplication]delegate]; // or [NSApplication sharedApplication] if your app it is for OS X
    

    then set your x var to the desired value

    appDelegate.x = 5 (or whatever)
    

    I tested this in one of my projects and works.

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

Sidebar

Related Questions

I have the following code in my AppDelegate : #import <UIKit/UIKit.h> @class PersonalDiarySystemViewController; @interface
I have setup coredata in my appDelegate, but it first loads the mainWindow.xib and
I have a Tableview on AppDelegate That calls a SecondView (dvController) when DidSelectRowAtIndexPath using:
I have an Obj-C method similar to this: -(void)getUserDefaults:(BOOL *)refreshDefaults { PostAppDelegate *appDelegate =
What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate.
I fix all warnings and now I have such error in my AppDelegate Class
I have a static variable on appDelegate declared like this: appdelegate.h file: +(NSMutableArray*)allBanco; +(void)setAllBanco:(NSMutableArray*)value;
I have value which i am storing in the var it gives error Date*aDate=[appDelegate.dates
I'm writing a Cocoa application where I have an auto generated app delegate:(MyAppDelegate.h/MyAppDelegate.m) So
I the allocated arrays in the didFinishLaunching of my appdelegate.And I released those arrays

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.