2014-02-22 151 views
0

阻礙錯誤信息的發現,但無法找到錯誤。誰能幫我?Xcode「發送到實例的無法識別的選擇器」

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"ErgebnisseCell"; 
    ErgebnisseCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 


    if (indexPath.section == 0) { 

    NSDictionary *aktion = self.wmXMLParser.alleAktionen [indexPath.row]; 
    __block NSString *VP= @""; 

    [aktion enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 
     if (VP.length) { 
      VP = [VP stringByAppendingString:@","]; 
     } 
     VP = [NSString stringWithFormat:@"%@%@ = %@", VP, key, obj]; 
    }]; 

    cell.spielpaarungLabel.text = VP; 
+0

後完整的錯誤信息,請。應該有班級名稱 – Avt

+0

或代碼行,發生錯誤。 – Avt

+0

這意味着你的實例沒有這樣的方法。檢查你是否發送消息到錯誤的實例。例如,當前應該是[A aMethod],但您可以調用[B aMethod]。它有時在使用收集而沒有檢查時發生。 –

回答

0

它在我看來好像您需要設置故事板中的單元格類型。它目前設置爲UITableViewCell而不是ErgebnisseCell,因此沒有spielsparungLabel屬性。

0

從方法

[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

的細胞中被返回是不是類型ErgebnisseCell的,因此將不響應的

spielpaarungLabel 

方法。

確保你在故事板或筆尖文件中的單元格的標識設置爲「ErgebnisseCell」

+0

你好, 這正是我的問題。在故事板中,我沒有分配自定義單元格。 但現在我有一個新問題。標籤「spielpaarungLabel」沒有填充數據,雖然字符串「VP」數據有(見日誌)。 – carlie

+0

這是日誌數據:2014-02-23 14:10:12.346信息[4010:70b] Brasilien:Kroatien = Spielpaarung,0:0 = Ergebniss,12 =標識符,12.06.14 = Spieltag1 2014-02-23 14:10:12.347信息[4010:70b] Brasilien:Kroatien = Spielpaarung,0:0 = Ergebniss,12 =標識符,12.06.14 = Spieltag1 2014-02-23 14:10:12.347信息[4010:70b] 13.06 .14 = Spieltag2,13 =標識符,0:0 = Ergebniss,Mexiko:Kamerun = Spielpaarung – carlie

+0

您是否已將自定義單元格類中的IBOutlet連接到界面構建器中的Label? –

相關問題