ios - NSException with UIImagePickerController -


i'm building first ios 7 ipad app in xcode 5 - need issue.

i'm following this tutorial:

i don't quite understand writer means with: "so open testpickerviewcontroller.h , want add in following class reference."

uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> 

i got view controller.h file here:

#import "viewcontroller.h"  @interface detailviewcontroller : viewcontroller <uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> { uiimagepickercontroller *imgpicker; iboutlet uiimageview *customimage; }  @property(nonatomic, retain)uiimagepickercontroller *imgpicker;  @end 

my view controller.m file:

#import "detailviewcontroller.h"  @interface detailviewcontroller ()  @end  @implementation detailviewcontroller @synthesize imgpicker, customimage;  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) {     // custom initialization } return self; }  - (void)viewdidload { [super viewdidload]; // additional setup after loading view.  // init image picker self.imgpicker = [[uiimagepickercontroller alloc]init]; self.imgpicker.allowsediting = yes; self.imgpicker.delegate = self; self.imgpicker.sourcetype = uiimagepickercontrollersourcetypephotolibrary; }  - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. }  /* #pragma mark - navigation  // in storyboard-based application, want little preparation before navigation - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { // new view controller using [segue destinationviewcontroller]. // pass selected object new view controller. } */ - (ibaction)addimage:(id)sender { // let user add image specific subject [self presentmodalviewcontroller:self.imgpicker animated:yes]; }  -(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingimage:(uiimage *)img editinginfo:(nsdictionary *)editinginfo { customimage.image = img; [[picker parentviewcontroller] dismissmodalviewcontrolleranimated:yes]; }  @end 

i ran app without doing wrote @ top, resulted in nsexception in main.m file.

what doing wrong here?

edit

main.m  #import <uikit/uikit.h>  #import "appdelegate.h"  int main(int argc, char * argv[]) { @autoreleasepool {     return uiapplicationmain(argc, argv, nil, nsstringfromclass([appdelegate class])); } } 

edit

2014-05-17 14:56:47.509 myapp[1424:60b] * terminating app due uncaught exception 'nsunknownkeyexception', reason: '[ setvalue:forundefinedkey:]: class not key value coding-compliant key image.'

check connection iboutlet customimage in interface builder (ib) , make sure name of referencing outlet , uiimageview match. can check clicking on connection inspector in ib (it's little arrow inside of circle).

in tutorial posted link shows iboutlet uiimageview declared image. i'm assuming changed name of iboutlet , forgot reconnect it. can check if iboutlet customimage connected checking if dot beside property declaration filled or empty. filled = connected , empty = not connected.

example of property declaration iboutlet:

@property (weak, nonatomic) iboutlet uiimageview * customimage; 

also, <uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> protocols. adding lines @interface declaration are, simply, stating that, "i want uiviewcontroller conform uinavigationcontrollerdelegate , uiimagepickercontrollerdelegate. want implement own code when events happen."


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -