アプリケーションでフォトギャラリーから写真を選択して表示しようとしましたが、別のプロジェクトでは問題なく動作しましたが、このプロジェクトではアプリケーションは正常に動作しますが、表示されるはずの UIButton を押すとギャラリーでは、int retVal = UIApplicationMain(argc, argv, nil, nil); の main.m でエラー 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 にリンクしましたが、そのボタンが原因でエラーが発生する原因がわかりません。
どんな助けでも大歓迎です。