1

アプリに基本を実装しようとしてUIAlertViewいます (ストーリーボードを使用しています)。しかし、アプリを実行すると、アプリの読み込み画面で停止した後、デバッガー画面に移動します。

私の .h:

    #import <UIKit/UIKit.h>
    @interface MindTripAnim :UIViewController {   
      IBOutlet UIImageView *animation;
    }

    - (IBAction)showMessage:(id)sender;

    @end

そして私の.m:

#import "MindTripAnim.h"
@interface MindTripAnim ()
@end

@implementation MindTripAnim

- (void)viewDidLoad {
   animation.animationImages = [NSArray arrayWithObjects:
                             [UIImage imageNamed:@"trips1.png"],
                             [UIImage imageNamed:@"trips2.png"],
                             [UIImage imageNamed:@"trips3.png"],
                             [UIImage imageNamed:@"trips4.png"],
                             [UIImage imageNamed:@"trips5.png"],                          
                             [UIImage imageNamed:@"trips6.png"],nil];
   [animation setAnimationRepeatCount:0];    
   animation.animationDuration = 0.65; 
   [animation startAnimating]; 
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)showMessage:(id)sender
{
    UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Hello World!" message:@"This is your first UIAlertview message." delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil];
    [message show];
}
@end

何が間違っているのか、またはアプリがロード画面で停止し続ける理由がわかりません。助けてください!

デバッガーでこれを見つけました

2012-12-01 19:39:03.428 MindTrip [3327:11303] * キャッチされない例外 'NSUnknownKeyException' が原因でアプリを終了しています。理由: '[ setValue:forUndefinedKey:]: このクラスは、キー Alert のキー値コーディングに準拠していません.' * First throw call stack: (0x1c9a012 0x10d7e7e 0x1d22fb1 0xb84711 0xb05ec8 0xb059b7 0xb30428 0x23c0cc 0x10eb663 0x1c9545a 0x23abcf 0xffe37 0x100418 0x100648 0x100882 0x4fa25 0x4fdbf 0x4ff55 0x58f67 0x1cfcc 0x1dfab 0x2f315 0x3024b 0x21cf8 0x1bf5df9 0x1bf5ad0 0x1c0fbf5 0x1c0f962 0x1c40bb6 0x1c3ff44 0x1c3fe1b 0x1d7da 0x1f65c 0x2a4d 0x2975) libc++abi.dylib:例外をスローして呼び出された終了 (lldb)

4

1 に答える 1

1

問題は、ストーリーボードalertに (または と呼ばれるビューへのポインターalert) を追加したことですが、同じことがクラス コードに追加されていないことです。アラート ビューをプログラムで表示している場合は、ストーリーボードから削除できます。

于 2012-12-02T01:51:19.427 に答える