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

  • Home
  • SEARCH
  • 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 8482001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:42:44+00:00 2026-06-10T19:42:44+00:00

Hello i am trying to copy the input from my textfield in the ViewController

  • 0

Hello i am trying to copy the input from my textfield in the ViewController to my AppDelegate.
No, not vice versa.

As i am trying to do this and i NSLog the gives me this:

StruktonTest[8467:11603] (null)

Btw, StruktonTest is the name of my Testapp.

Here’s my code where i get text in the ViewController:

if ([[[self m_textfield] text] length] == 10) {
m_textfield.text=[NSString stringWithFormat:@"%@", m_textfield.text];
NSLog(@"%@", m_textfield.text);
telefoonnummer = m_textfield.text;

I copy it to my AppDelegate.h file like this:

@interface  LocationDelegate : NSObject <CLLocationManagerDelegate> 
{
UILabel * resultsLabel;
NSString *phonenumber;


}

- (id) initWithLabel:(UILabel*)label;
-(id)initWithDictionary:(NSDictionary *)dict;
-(id)initWithName:(NSString *)aName;
-(NSDictionary *)toDictionary;

@property (nonatomic , retain) NSString *phonenumber;

And here’s my code from the ViewController, maybe i make the misstake here:

@interface LocationTestViewController : UIViewController <CLLocationManagerDelegate> {
IBOutlet UILabel * m_significantResultsLabel;
IBOutlet UISwitch * m_significantSwitch;
IBOutlet UISwitch * m_mapSwitch;
IBOutlet MKMapView * m_map;
IBOutlet UITextField * m_textfield;
NSString *String;
IBOutlet UILabel * mobielnummer;
IBOutlet UILabel * deellocatie;
IBOutlet UILabel * welldone;
IBOutlet UILabel * locatiemaps;
IBOutlet UILabel * mapslocatie;
NSString *telefoonnummer;



LocationDelegate * m_significantDelegate;

// location objects
CLLocationManager* m_gpsManager;
CLLocationManager* m_significantManager;
}

-(IBAction) actionSignificant:(id)sender;
-(IBAction) actionMap:(id)sender;
-(IBAction) actionLog:(id)sender;
-(IBAction)changrGreeting ;



@property (retain, nonatomic) IBOutlet UILabel * m_significantResultsLabel;
@property (retain, nonatomic) IBOutlet UISwitch * m_significantSwitch;
@property (retain, nonatomic) IBOutlet UISwitch * m_mapSwitch;
@property (retain, nonatomic) IBOutlet MKMapView * m_map;
@property (nonatomic ,retain) IBOutlet UITextField *m_textfield;
@property (nonatomic, copy) IBOutlet NSString *String;
@property (nonatomic, retain) IBOutlet UILabel  *mobielnummer;
@property (nonatomic, retain) IBOutlet UILabel  *deellocatie;
@property (nonatomic, retain) IBOutlet UILabel  *welldone;
@property (nonatomic, retain) IBOutlet UILabel  *locatiemaps;
@property (nonatomic, retain) IBOutlet UILabel  *mapslocatie;
@property (nonatomic , retain) NSString *telefoonnummer;



@end

And this is the code from my AppDelegate.m

LocationTestViewController*locationTestViewController = [[LocationTestViewController   alloc]init];
phonenumber = locationTestViewController.telefoonnummer;
NSLog(@"%@", phonenumber);

So i’m recieving the NULL when i copy this.
Does anybody know how to fix this. Would be appreciated.

  • 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-06-10T19:42:45+00:00Added an answer on June 10, 2026 at 7:42 pm

    This code:

    LocationTestViewController*locationTestViewController = [[LocationTestViewController   alloc]init];
    phonenumber = locationTestViewController.telefoonnummer;
    NSLog(@"%@", phonenumber);
    

    Is creating a new instance of LocationTestViewController, then reading the .telefoonnummer field which is obviously empty.

    Surely instead of the AppDelegate ‘reading’ the field, you can use your ViewController to ‘give’ the field to the AppDelegete?

    You could use the NSUserDefaults as a temporary store, or use code like this in your ViewController:

    YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
    appDelegate.phoneNumber = self.telefoonnummer;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello Trying to sort this list by Month and day. Can not get it
hello i am trying a sqlite database tutorial to build, but its not working
hello i am trying to load a list of filenames from a folder into
Hello I was trying to remove objects from object array that I have and
Hello I'm trying something .. I was reading Jquery traversing documentations some forums, this
This is my first post here after many visits. Hello! I am trying to
Hello i am trying to return a struct from a function but i cant
I'm trying to copy some files from one network share to another using File::Copy.
i'm trying to make this code snippet from the sinatra tutorial work so that
Hello Im trying to get the value of an element from a JsonObject. i'm

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.