我试图从核心数据条目中提取一些值并将它们分配给 NSStrings。到目前为止,我的代码如下所示:
#import "CopyToClipViewController.h"
@interface CopyToClipViewController ()
@end
@implementation CopyToClipViewController
@synthesize device;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
if (self.device) {
NSString *namevalue;
NSString *versionvalue;
NSString *companyvalue;
[namevalue setText:[self.device valueForKey:@"name"]];
[versionvalue setText:[self.device valueForKey:@"version"]];
[companyvalue setText:[self.device valueForKey:@"company"]];
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
我收到错误消息,“NSString”的 No Visible @interface 声明选择器“setText:”用于尝试将数据设置为 NSString 的所有三行。任何解决方案的想法?提前致谢!