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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:34:12+00:00 2026-05-30T17:34:12+00:00

SOLUTION BELOW – Not really the problem I thought it was. I’m adding data

  • 0

SOLUTION BELOW – Not really the problem I thought it was.

I’m adding data to the view controller that’s being segued into, using prepareForSegue:sender:, but my problem is that if the data is set using a property then that property is not changed. I can, however, use a private variable of the destination view controller, set using a function built for that purpose.

Here’s the code that works:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"showLocationDetail"]) {
        CityGuideFlipsideViewController *flipside = [segue destinationViewController];
        CityGuideAnnotation *senderAnnotation = (CityGuideAnnotation *)sender;
        [flipside annotate:senderAnnotation]; // why?
    } 
}

It seems much more natural, though, to use flipside.annotate = senderAnnotation than [flipside annotate:senderAnnotation].

Surely I must be doing something obvious here, but I can’t spot it.

EDIT to give the fail case more clearly:

// CityGuideFlipsideViewController.h
@interface CityGuideFlipsideViewController : UIViewController {
    CityGuideAnnotation *annotation;
}
@property (strong, nonatomic) CityGuideAnnotation *annotation;

// CityGuideFlipsideViewController.m
@synthesize annotation;
- (void)setAnnotation:(CityGuideAnnotation *)_annotation
{
    annotation = _annotation;
}

// CityGuideMainViewController.m (in prepareForSegue:sender)
CityGuideFlipsideViewController *flipside = [segue destinationViewController];
CityGuideAnnotation *senderAnnotation = (CityGuideAnnotation *)sender;
flipside.annotation = senderAnnotation;

On reaching the line assigning flipside.annotation as senderAnnotation the value of senderAnnotation is correct. flipside.annotation before assignment is nil. Following that line senderAnnotation is unchanged, flipside.annotation is unchanged.

BUT, reaching CityGuideFlipsideViewController viewDidLoad I have NSLog(@"%@",annotation.title) which spits out the correct value, even though the debugger still shows me nil for annotation.

So I’m really not sure if I previously had some minor error of if all along I’ve been fooled by annotation CityGuideAnnotation * 0x00000000 in the debugger.

Sorry about that, and thanks to those who helped.

  • 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-30T17:34:13+00:00Added an answer on May 30, 2026 at 5:34 pm

    Error was not in the code using a property. I was fooled by the debugger showing nil as the pointer. I’ll be more careful to log values in the future.

    See edit on question above for more details.

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

Sidebar

Related Questions

Figured it out, solution below! I have an HTML table that is being populated
I thought of solution below because the collection is very very small. But what
I came with below solution but I believe that must be nicer one out
Premise This problem has a known solution (shown below actually), I'm just wondering if
I tried the solution below without success. In the controller method MvcAction , the
[SOLVED: See solution below.] I'm having a problem writing a RewriteMap program (using Python).
The solution below compiles but it is not what I want. I would like
EDITED with solution (below...) I have a Splash screen that is packaged into it's
Problem solved. Solution below. It's been long since I tried to do this in
I added the solution to the code below. The code at the bottom is

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.