我是iPhone新手,并且从这里获得了很大的成功,因此我希望能够直接获得帮助。我正在将数据读入plist的tableview中。该应用程序工作正常,但我编译时得到2个警告。我知道为什么我会得到这些错误,但我一直没有解决问题。虽然这个应用程序的作品,我真的想有效解决警告。当我尝试将NSDictionary更改为NSArray时,警告消失,但表不再填充。从nsdictionary分配给nsarray的不兼容指针类型
任何帮助将不胜感激。
工作人员和数据在委托.h文件中定义为NSArray。警告显示在下面的代理.m文件中。
我的代表有以下几点:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the tab bar controller's current view as a subview of the window
NSString *Path = [[NSBundle mainBundle] bundlePath];
NSString *DataPath = [Path stringByAppendingPathComponent:@"Data.plist"];
NSString *SPath = [[NSBundle mainBundle] bundlePath];
NSString *StaffPath = [SPath stringByAppendingPathComponent:@"Staff.plist"];
NSDictionary *tempDict = [[NSDictionary alloc] initWithContentsOfFile:DataPath];
**self.data = tempDict;**
[tempDict release];
NSDictionary *staffDict = [[NSDictionary alloc]initWithContentsOfFile:StaffPath];
**self.staff = staffDict;**
[staffDict release];
在我的工作人员的ViewController我有以下几点:在你的代码
if(CurrentLevel == 0) {
//Initialize our table data source
NSArray *staffDict = [[NSArray alloc] init];
self.tableDataSource = staffDict;
[staffDict release];
Midwest_DigestiveAppDelegate *AppDelegate = (Midwest_DigestiveAppDelegate *)[[UIApplication sharedApplication] delegate];
self.tableDataSource = [AppDelegate.staff valueForKey:@"Rows"];
}
else
self.navigationItem.title = CurrentTitle;
你解决了这个问题吗? @Corey Brown我遇到同样的问题 –