Ios 如何在不同的ViewController中显示类别值
我拥有基类Ios 如何在不同的ViewController中显示类别值,ios,objective-c,instance,categories,Ios,Objective C,Instance,Categories,我拥有基类连接和类别CoreDataProperties。在我的“FirstViewController”中,我将数据存储到CoreDataProperties属性,并且我还能够使用连接类的实例显示数据。我的问题是,我想访问我的SecondViewController中存储的值。如果我为Connections和访问方式创建对象,它将显示null 连接+CoreDataProperties.h @interface EY_Connections (CoreDataProperties) @prop
连接
和类别CoreDataProperties
。在我的“FirstViewController”中,我将数据存储到CoreDataProperties
属性,并且我还能够使用连接
类的实例显示数据。我的问题是,我想访问我的SecondViewController
中存储的值。如果我为Connections
和访问方式创建对象,它将显示null
连接+CoreDataProperties.h
@interface EY_Connections (CoreDataProperties)
@property (nullable, nonatomic, retain) NSString *connectionAddress;
@property (nullable, nonatomic, retain) NSString *connectionStatus;
@end
Firstviewcontroller.m
Connections *connect;
NSLog(@"ConnectionNo correct==>>%@",connect.connectionStatus);
Connections *conn;
NSLog(@"er==>%@",conn.connectionStatus);
它显示ConnectionStatus值。但如果我在SecondviewController
中执行此操作。它不显示
SecondViewController.m
Connections *connect;
NSLog(@"ConnectionNo correct==>>%@",connect.connectionStatus);
Connections *conn;
NSLog(@"er==>%@",conn.connectionStatus);
问题是什么?如何在SecondViewController中显示存储的类别值?属性“connectionStatus”在哪里?请向Superclass说明您正在Firstviewcontroller.m中实例化连接,对吗?您需要实例化它或从上一个viewcontroller传递它。如果我在appDelegate中实例化也意味着,我无法访问该对象。。。。