我是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我遇到同樣的問題 –