SORU
5 EKİM 2012, Cuma


DequeueReusableCellWithİdentifier onaylama işlemi hatası:forİndexPath:

Benim okul için bir rss okuyucu yapıyordum ve kod işini bitirdim. Test yaptım ve bana hata verdi. Burada atıfta bulunuyor kodu:

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

        cell = 
         [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle  
                                reuseIdentifier:CellIdentifier];

    }

işte çıktı hata:

2012-10-04 20:13:05.356 Okuyucu[4390:c07]* Onaylama işlemi hatası -[UİTableView dequeueReusableCellWithİdentifier:forİndexPath:], /SourceCache/UİKit_Sim/-2372/UİKit UİTableView.m:4460 2012-10-04 20:13:05.357[4390:c07] OkuyucuSonlandırıcı yakalanmamış nedeniyle app istisna '', sebep: 'açılamıyor NSİnternalİnconsistencyException tanımlayıcı Hücre hücre sıradan çıkarma - bir kalem ucu veya bir sınıf kaydetmek gerekir için tanımlayıcı ya da bir film şeridi içinde bir prototip hücre bağlayın' *İlk atış çağrı yığını: (0x1c91012 0x10cee7e 0x1c90e78 0xb64f35 0xc7d14 0x39ff 0xd0f4b 0xd101f 0xb980b 0xca19b 0x6692d 0x10e26b0 0x228dfc0 0x228233c 0x228deaf 0x1058cd 0x4e1a6 0x4ccbf 0x4cbd9 0x4be34 0x4bc6e 0x4ca29 0x4f922 0xf9fec 0x46bc4 0x47311 0x2cf3 0x137b7 0x13da7 0x14fab 0x26315 0x2724b 0x18cf8 0x1becdf9 0x1becad0 0x1c06bf5 0x1c06962 0x1c37bb6 0x1c36f44 0x1c36e1b 0x147da 0x1665c 0x2a02 0x2935) kütüphanenin abi.dylib: sona erdirmek, bir özel durum üretiliyor

ve burada hata ekranda gösterir. şifre:

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

yardım lütfen!

CEVAP
5 EKİM 2012, Cuma


dequeueReusableCellWithIdentifier:forIndexPath: yöntemi kullanıyorsun. Bu yöntem için documentation şöyle der:

Önemli:Sınıf ya da uç bir dosya bu yöntemi çağırmadan önce registerNib:forCellReuseIdentifier: registerClass:forCellReuseIdentifier: yöntemi kullanarak kaydetmeniz gerekir.

Bir kalem ucu veya yeniden tanımlayıcı "Cell" bir sınıf için bir kayıt yoktu.

Kodu baktığımızda, sıradan çıkarma yöntemi eğer bir hücre vermek zorunda değil mi nil dönmek için bekliyor gibisin. Bu davranış için dequeueReusableCellWithIdentifier: kullanmanız gerekir:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

dequeueReusableCellWithIdentifier: dequeueReusableCellWithIdentifier:forIndexPath: farklı yöntem olduğuna dikkat edin. the former the latter için doktor bakın.

Eğer güvenli bir şekilde anlamak istiyorsanız hiçdequeueReusableCellWithIdentifier:forIndexPath:, check out this Q&Akullanın.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • CareyHolzman

    CareyHolzman

    24 Ocak 2008
  • filmurfreakur

    filmurfreaku

    29 Mart 2007
  • RobertDuskin

    RobertDuskin

    12 HAZİRAN 2008