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

The Archive Base Latest Questions

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

i know c passes by reference and im sure thats where my problem lies,

  • 0

i know c passes by reference and im sure thats where my problem lies, but for the life of me i cannot figure this out. (also there may be a framework or a more proper way of doing this, which im open to suggestions)

CrestronControllerValues is just a getter and setter class

i intialize and pass it in my app delegate:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSArray *keys = [NSArray arrayWithObjects:@"IPaddress", @"PortNumber", nil];

NSArray *objs = [NSArray arrayWithObjects:@"10.8.30.111", @"41794", nil];

NSDictionary *dict = [NSDictionary dictionaryWithObjects:objs forKeys:keys];

[defaults registerDefaults:dict];



CrestronControllerValues *CCV = [[[CrestronControllerValues alloc]init]autorelease];
[CCV setIPID:3];
[CCV setIPaddress:[defaults stringForKey:@"IPaddress"]];
[CCV setPortNumber:[defaults stringForKey:@"PortNumber"]];

cClient = [[CrestronClient alloc] initWithCCV:CCV];

as you can see the last line passes it to another class
this is where my problem comes into play
if i try to use getipaddress or getportnumber i get bad access

- (id)initWithCCV:(CrestronControllerValues *)ccv
{
    [super init];

    CCV = [CrestronControllerValues alloc];
    CCV = ccv;

    port = [[ccv getPortNumber] intValue];
    ip = [ccv getIPaddress];

    NSLog(@"ip %@ ~ port %@", ip, port);

    return self;
}

i have tried multiple ways, including
cClient.ccv = ccv (as opposed to sending it with the init)
tried adding a getter for self so that it would be cClient = [[CrestronClient alloc] initWithCCV:[CCV getSelf]];

  • 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-25T18:24:26+00:00Added an answer on May 25, 2026 at 6:24 pm

    Considering CCV in your last snippet of code is an ivar, try this instead:

    CCV = [ccv retain];
    

    You don’t need to allocate space for an existing object. Also, be careful with your init method pattern, you may want to take a look in the documentation.

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

Sidebar

Related Questions

Know this might be rather basic, but I been trying to figure out how
I know Javascript always passes objects by reference. But what about the other types?
I apologize if this was asked somewhere else, but I do not know how
I know there's the option to pass a value by reference, simply by writing
Edit for intro: We know that a ref parameter in C# passes a reference
I'm pretty sure this is a duplicate question, but I can't find the original(s).
May I know what is the workaround to make this code passed, in Visual
Know of any good libraries for this? I did some searches and didn't come
I'm not quite sure stackoverflow is a place for such a general question, but
The wikipedia page on TwoFish points at this reference implementation in C (and code

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.