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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:48:31+00:00 2026-05-23T03:48:31+00:00

having issues getting a value from a NSString in my view controller to my

  • 0

having issues getting a value from a NSString in my view controller to my delegate. The issue is the userId string. it comes back with an error in the delegate

error: accessing unknown ‘userId’ class method

view controller snippet ( profileViewController.m )

  -(void)parserDidEndDocument:(NSXMLParser *)parser
{
    NSDictionary *rowData = [self.userArray objectAtIndex:0];
    self.userId = [[NSMutableString alloc] initWithFormat:@"%@", [rowData objectForKey:@"id"]];

    NSLog(@"DONE PARSING DOCUMENT");
    NSLog(self.userId);

}

- (void)viewDidLoad
{
    self.title = @"Profile";
    interestingTags = [[NSSet alloc] initWithObjects: INTERESTING_TAG_NAMES];
    self.userArray = [[NSMutableArray alloc] init];
    [super viewDidLoad];
}

delegate

    #import "profileViewController.h"

@implementation experimentAppDelegate

@synthesize window;
@synthesize rootController;

    -(void)goingOffline
{
    NSMutableData *data = [NSMutableData data]; 

    NSString *userID = profileViewController.userId;

    NSString *userString = [[NSString alloc] initWithFormat:@"id=%@", userID];

    //NSLog(nameString);
    //NSLog(numberString);

    [data appendData:[userString dataUsingEncoding:NSUTF8StringEncoding]];

    NSURL *url = [NSURL URLWithString:@"http://www.website.net/test.php"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

    [request setHTTPMethod:@"POST"];
    [request setHTTPBody:data];

    NSURLResponse *response;
    NSError *err;
    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
    NSLog(@"responseData: %@", responseData); }
  • 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-23T03:48:32+00:00Added an answer on May 23, 2026 at 3:48 am

    profileViewController is your class. To access userId directly, it should be defined as,

    + (NSString *) userId;
    

    and not,

    - (NSString *) userId; // (or)
    @property (nonatomic, copy) NSString * userId;
    

    Edit

    Since profileViewController is one of the view controllers in the tab bar controller instance rootController, you can try getting the profileViewController instance like this,

    profileViewController * theController;
    NSArray * viewControllers = rootController.viewControllers;
    for ( UIViewController * viewController in viewControllers ) {
        if ( [viewController isMemberOfClass:[profileViewController class]] ) {
            theController = viewController;
        }
    }
    
    NSString * userID = theController.userId;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a little issue with getting a value of field in HTML using
Am having some SQL ( SqlCe ) issues I was getting the following error:
I'm having issues getting Firefox to update a webpage when its class is changed
We are having some issues getting SharePoint to work as we want it to.
I am using Fluent NHibernate and having some issues getting a many to many
I'm having issues getting my databinding working for a ListBox. I suspect it's because
i am having trouble getting this to work, can any one spot the issue?
I'm having issues getting UpdatePanel working in a large, existing solution. I have a
I'm currently having issues with getting log4net to work within a particular dll. I'm
I'm having a problem.. Actually I do have an issue when sending a value

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.