我一直试图让我的应用程序选择从照片库中的照片,然后显示它的时候,它的工作在不同的项目很好,但在这一个应用程序运行正常,但当我按那应该弹出画廊的UIButton,我得到的main.m错误SIGABRT上INT retVal的= UIApplicationMain(ARGC,ARGV,无,无);的Xcode SIGABRT访问照片库
正如我所说的,这曾在过去的罚款,所以我不知道它为什么不现在,这里的相关错误代码的部分,我只是张贴做,因为我有很多代码,并且这样更容易。
ViewController.h
#import <UIKit/UKit.h>
@interface ViewController : UIViewController
<UIImagePickerControllerDelegate, UINavigationControllerDelegate>
{
//Blah blah blah
}
//Blah blah blah
-(IBAction) selectExistingpicture;
@property (nonatomic, retain) IBOutlet UIImageView *theImageView;
//Blah blah blah
@end
ViewController.m
#import "ViewController.h"
@implementation ViewController
@synthesize theImageView;
-(IBAction) selectExistingPicture
{
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
[picker release];
}
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
theImageView.image = image;
[picker dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
[picker dismissModalViewControllerAnimated:YES];
}
我已链接到selectExistingPicture一个UIButton,但我不知道是什么导致该按钮来使我的错误。
任何帮助是极大的赞赏。
你能发布有关堆栈跟踪任何控制台输出? –
2011-07-26 22:08:44.016的刑期[6923:207] - [视图控制器selectExistingpicture]:无法识别的选择发送到实例0x4b46c20 2011-07-26 22:08:44.020项目[6923:207] ***终止应用程序由于未捕获的异常“NSInvalidArgumentException”,原因:“ - [视图控制器selectExistingpicture]:无法识别的选择发送到实例0x4b46c20” ***在第一掷调用堆栈: –
是一个iPad或iPhone应用??? – makboney