Objective c Can';t在视图控制器之间传递数据

Objective c Can';t在视图控制器之间传递数据,objective-c,ios,Objective C,Ios,可能重复: 我有时使用viewcontroller之间的数据传递没有问题,但这次不会。请帮忙 我的FirstViewController.m #import "SecondViewController.h" - (IBAction)passBtn:(id)sender { SecondViewController *second =[[SecondViewController alloc] initWithNibName:nil bundle:nil]; second.str

可能重复:

我有时使用viewcontroller之间的数据传递没有问题,但这次不会。请帮忙

我的FirstViewController.m

#import "SecondViewController.h"

- (IBAction)passBtn:(id)sender
{
    SecondViewController *second =[[SecondViewController alloc] initWithNibName:nil bundle:nil];
    second.stringData = dataString.text;
    second.stringNumber = numberString.text;
    second.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:second animated:YES];
}
我的第二个视图控制器

#import <UIKit/UIKit.h>

@interface SecondViewController : UIViewController

@property(nonatomic, retain) NSString *stringData;
@property(nonatomic, retain) NSString *stringNumber;

@end

我也有使用其他方法但错误是一样的,总是说找不到对象的类型。但如果我在命令的同时单击我的stringData或stringNumber,它会将我带到SecondViewController.h并指向我的stringData或stringNumber。请提供帮助。

请确认在第二个视图控制器实现文件中,您正在为界面中声明的两个属性使用@sythesize


这似乎是造成问题的原因

请跟我的不一样。过程是一样的,但我有一些错误。这肯定是你的实际代码,因为它应该是好的。您是否收到任何其他编译器警告,或正在进行任何其他导入?这是第二个控制器头文件的全部内容吗?我同意,这不是链接问题的重复。OP正在尝试做正确的事情,但是由于其他原因导致了错误。我只是好奇,这是因为我使用了选项卡栏吗?我总是使用此方法传递数据,但这次不是。您的项目目录/子目录中是否可能有多个版本的SecondViewController.h?(你试过清理你的构建目录吗?)我也已经合成了。很奇怪。是因为我使用了选项卡栏吗?请添加第二个ViewController实现代码。对不起,我的错误,Phillip Mills是真的,因为我有多个版本的项目。我删除了旧的一个和它的工作现在。
Property 'stringData' not found on object of type 'SecondViewController *'
Property 'stringNumber' not found on object of type 'SecondViewController *'