Reputation: 10108
I have two view controllers with a segue between them. I'm calling the segue via code and I want to pass an NSString between the two view controllers. Looks like Xcode reaches the line where I set the value for the NSString in the second view controller, but when the actual controller loads it shows 0x0000000 instead of the actual data.
This is how I call the second view controller
[self performSegueWithIdentifier:@"SegueuIdentifier" sender:reader];
This is how I set the value on the second view controller (there is only one segue):
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
SecondViewController *secondViewController = [segue destinationViewController];
[secondViewController setStringValue:[NSString stringWithFormat:@"http://test.com/test.html?t=%@", testValue]];
}
I'm sure the testValue has value (I made sure in debug mode).
On the second view controller this is what I have in the h file:
@property (weak, nonatomic) IBOutlet NSString *UrlAddress;
And I made sure I @synthesize
it.
Upvotes: 0
Views: 261
Reputation: 9935
You should make the property strong:
@property (strong, nonatomic) NSString *UrlAddress;
Upvotes: 2