Iphone 我得到运行时错误:类不符合密钥映像的密钥值编码

Iphone 我得到运行时错误:类不符合密钥映像的密钥值编码,iphone,xcode,Iphone,Xcode,让我简要介绍一下我的项目,我正在显示照片库中的图像,我的视图控制器中有Imageview和按钮,当我按下按钮时,它将导航到照片库。当我从照片库中选择照片时,图像将显示在图像视图中 但当我运行这个项目,我得到了运行时错误,请看代码,并建议我的解决方案,如果我丢失了任何文件,请通知我,这样我就可以为您的必要上传 我没有得到错误的确切位置,我在谷歌上搜索,甚至看到堆栈溢出,但我仍然找不到任何解决方案 下面是Viewcontroller.m文件和控制台查看错误,请告诉我 view controller.

让我简要介绍一下我的项目,我正在显示照片库中的图像,我的视图控制器中有Imageview和按钮,当我按下按钮时,它将导航到照片库。当我从照片库中选择照片时,图像将显示在图像视图中

但当我运行这个项目,我得到了运行时错误,请看代码,并建议我的解决方案,如果我丢失了任何文件,请通知我,这样我就可以为您的必要上传

我没有得到错误的确切位置,我在谷歌上搜索,甚至看到堆栈溢出,但我仍然找不到任何解决方案

下面是Viewcontroller.m文件和控制台查看错误,请告诉我

view controller.m 


//
//  ViewController.m
//  ImagePicker
//
//  Created by Vaibhav on 12/30/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"

@implementation ViewController

@synthesize imagepic;


-(IBAction)ButtonClicked{



    ipc=  [UIImagePickerController alloc];
    ipc.delegate=self;

    ipc.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

    [self presentModalViewController:ipc animated:YES ];



}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    imagepic.image= [info objectForKey:UIImagePickerControllerOriginalImage ];
    [ [picker parentViewController] dismissModalViewControllerAnimated:YES ];

    [picker release];


}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
    [ [picker parentViewController]dismissModalViewControllerAnimated:YES ];
    [picker release];
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end
控制台上的错误消息:

2012-12-30 13:03:05.758 ImagePicker[1409:f803] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x687b2e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key image.'
*** First throw call stack:
(0x13b9052 0x154ad0a 0x13b8f11 0x9b0032 0x921f7b 0x921eeb 0x93cd60 0x22f91a 0x13bae1a 0x1324821 0x22e46e 0xd5e2c 0xd63a9 0xd65cb 0x36a73 0x36ce2 0x36ea8 0x3dd9a 0xebe6 0xf8a6 0x1e743 0x1f1f8 0x12aa9 0x12a3fa9 0x138d1c5 0x12f2022 0x12f090a 0x12efdb4 0x12efccb 0xf2a7 0x10a9b 0x1d02 0x1c75)
terminate called throwing an exceptionCurrent language:  auto; currently objective-c
(gdb) 
2012-12-30 13:03:05.758 ImagePicker[1409:f803]***由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[setValue:forUndefinedKey:]:此类不符合密钥图像的键值编码。”
***第一次抛出调用堆栈:
(0x13b9052 0x154ad0a 0x13b8f11 0x9b0032 0x921f7b 0x921EB 0x93cd60 0x22f91a 0x13bae1a 0x1324821 0x22e46e 0xd5e2c 0xd63a9 0xd65cb 0x36a73 0x36ce2 0x36ea8 0x3dd9a 0xebe6 0xf8a6 0x1e743 0x1f1f8 0x12aa9 0x12a3fa9 0x138d1c5 0x12f2022 0x12f090a 0x12efdb4 0x12efccb 0xf2a7 0x10a9b 0x1D002 1C75)
终止调用抛出异常当前语言:auto;当前目标-c
(gdb)

在您的
视图控制器.xib
中,选择您的图像视图并检查
IBOutlet连接
。如果它连接到名为
image
IBOutlet
,请将其卸下。图像视图应连接到相应的
.h
文件中的
IBOutlet
。您可能已将
UIImageView
重命名为
imagePic
,它以前是
image

是的,现在我可以编译了,但在控制台中,它向我显示了darwin”。sharedlibrary将加载规则全部附加到进程1520。我仍然看不到照片库。加载需要多长时间?有人回答这个问题吗??