问题描述
我在 AppDelegate.m 接口中创建了一个属性 countryNameInitials
作为 NSMutableArray 并合成它.目的是存储全局数据以在表格视图中显示.在表视图控制器中:
I create a property countryNameInitials
as NSMutableArray in AppDelegate.m interface and synthesize it. The purpose is to store global data to display in table view. In the table view controller:
#import "AppDelegate.h"
...
@implementation
#define AppDelegate [[UIApplication sharedApplication] delegate]
...
问题是我无法使用 AppDelegate.countryNameInitials
访问数据.任何想法?
The problem is that I cannot use AppDelegate.countryNameInitials
to access the data. Any idea?
推荐答案
访问 countryNameInitials
的问题是由于我在 AppDelegate.m 中声明了该属性.将其移至 AppDelegate.h 后,错误消失了.
The problem of accessing countryNameInitials
is due to I declared the property in AppDelegate.m. After I move it to AppDelegate.h, errors are gone.
附注:1. AppDelegate
作为标识符名称对我有用.@Vakio 建议的命名冲突不相关.
Side notes:1. AppDelegate
as the identifier name works for me. Naming conflicts suggested by @Vakio is not relevant.
这篇关于AppDelegate 的属性不可访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!