3

次のようなエラーが発生します
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The NIB data is invalid.'

AutoLayoutiOS 5.0のチェックを外して、カスタムセルのiOSのすべてのバージョンの展開をサポートしたとしても。

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {

        static NSString *CustomCellIdentifier = @"GroupListCell";

        GroupListCell *cell = (GroupListCell *)[tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier];

            if (cell == nil)
            {
                NSArray *nib;

                if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
                {
                    nib= [[NSBundle mainBundle] loadNibNamed:@"GroupListCell" owner:self options:nil];
                }
                else{
                    nib= [[NSBundle mainBundle] loadNibNamed:@"GroupListiPhoneCell" owner:self options:nil]; // sigabrt
                }
                // cell implementation code..
           }
}

このコードはiOS6.0では正常に機能しますが、iOS5.0では機能しません。
どうした?私は何かが足りないのですか。

4

5 に答える 5

15

下の図で設定された値を含むnibファイルを確認してください
ここに画像の説明を入力

UILabel UIButtonテキストも チェック

ここに画像の説明を入力

于 2013-02-22T07:48:38.363 に答える
4

また、問題が発生するAutoLayout場合もあります。xib file - inspector pane - un tick を取りますautolayout

于 2013-08-15T09:47:34.747 に答える
2

最後に、問題を見つけました。

セルに textview が 1 つあり、Text プロパティが "Plain" として定義されている場合でも、属性付きのテキストがあります。「プレーン」では変更されません。変更はテキストで手動で行われるため、キーワードを入力して次の行に移動します。内部的には「帰属」と見なされます。

そのため、TextView の text プロパティを 2 回確認します。:)

于 2013-02-22T11:04:22.763 に答える
1

iOS 6 の下位バージョンでは、発生する可能性があります。

この問題を解決するために

ストーリーボードを選択してから

File Inspector->Interface Builder Documentチェックを外すUse Auto Layout

File Inspector->LocalizationチェックBaseを外してチェックEnglish

于 2014-10-26T06:36:32.143 に答える
1

あなたのケースでは、セルを抽出するためのコードが欠落している可能性があります。以下の修正されたコードが機能することを願っています。

if (cell == nil)
            {
                NSArray *nib;

                if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
                {
                    nib= [[NSBundle mainBundle] loadNibNamed:@"GroupListCell" owner:self options:nil];

                  cell = [nib objectAtindex:0]; 
                }
                else{
                    nib= [[NSBundle mainBundle] loadNibNamed:@"GroupListiPhoneCell" owner:self options:nil]; // sigabrt
                  cell = [nib objectAtindex:0];
                }
                // cell implementation code..
           }
于 2013-02-22T07:07:50.830 に答える