ios crash before launch - black screen on simulator -


2014-11-18 16:33:01.840 record-upload[2077:112380] *** terminating app due uncaught exception 'nsunknownkeyexception', reason: '[<viewcontroller 0x7f84b3076400> setvalue:forundefinedkey:]: class not key value coding-compliant key pausebuttontapped.' *** first throw call stack: (     0   corefoundation                      0x00000001049cbf35 __exceptionpreprocess + 165     1   libobjc.a.dylib                     0x00000001042bbbb7 objc_exception_throw + 45     2   corefoundation                      0x00000001049cbb79 -[nsexception raise] + 9     3   foundation                          0x0000000103a4a7b3 -[nsobject(nskeyvaluecoding) setvalue:forkey:] + 259     4   corefoundation                      0x0000000104915e80 -[nsarray makeobjectsperformselector:] + 224     5   uikit                               0x000000010507dc7d -[uinib instantiatewithowner:options:] + 1506     6   uikit                               0x0000000104edcf98 -[uiviewcontroller _loadviewfromnibnamed:bundle:] + 242     7   uikit                               0x0000000104edd588 -[uiviewcontroller loadview] + 109     8   uikit                               0x0000000104edd7f9 -[uiviewcontroller loadviewifrequired] + 75     9   uikit                               0x0000000104eddc8e -[uiviewcontroller view] + 27     10  uikit                               0x0000000104dfcca9 -[uiwindow addrootviewcontrollerviewifpossible] + 58     11  uikit                               0x0000000104dfd041 -[uiwindow _sethidden:forced:] + 247     12  uikit                               0x0000000104e0972c -[uiwindow makekeyandvisible] + 42     13  uikit                               0x0000000104db4061 -[uiapplication _callinitializationdelegatesformainscene:transitioncontext:] + 2628     14  uikit                               0x0000000104db6d2c -[uiapplication _runwithmainscene:transitioncontext:completion:] + 1350     15  uikit                               0x0000000104db5bf2 -[uiapplication workspacedidendtransaction:] + 179     16  frontboardservices                  0x000000010a9dc2a3 __31-[fbsserialqueue performasync:]_block_invoke + 16     17  corefoundation                      0x000000010490153c __cfrunloop_is_calling_out_to_a_block__ + 12     18  corefoundation                      0x00000001048f7285 __cfrunloopdoblocks + 341     19  corefoundation                      0x00000001048f7045 __cfrunlooprun + 2389     20  corefoundation                      0x00000001048f6486 cfrunlooprunspecific + 470     21  uikit                               0x0000000104db5669 -[uiapplication _run] + 413     22  uikit                               0x0000000104db8420 uiapplicationmain + 1282     23  record-upload                       0x0000000103622883 main + 115     24  libdyld.dylib                       0x000000010817b145 start + 1 ) libc++abi.dylib: terminating uncaught exception of type nsexception 

i don't understand says reason: '[<viewcontroller 0x7f9f5304ba00> setvalue:forundefinedkey:]: class not key value coding-compliant key pausebuttontapped

there no line in code attempts (i hate dump code on here feel needed)

code program records audio, puts out using ftp server

#import "networkmanager.h" #include <cfnetwork/cfnetwork.h> #import "viewcontroller.h"  enum {     ksendbuffersize = 32768 };  @interface viewcontroller () <nsstreamdelegate>{     avaudiorecorder *recorder;     avaudioplayer *player; } @property (strong, nonatomic) nstimer *timer; @property (strong, nonatomic) nsdate *startdate;   - (ibaction)sendbuttonpush:(id)sender;  @property (weak, nonatomic) iboutlet uilabel *status; @property (weak, nonatomic) iboutlet uilabel *time;  @property (weak, nonatomic) iboutlet uibutton *sendbutton;  @property (nonatomic, assign, readonly ) bool              issending; @property (nonatomic, strong, readwrite) nsoutputstream *  networkstream; @property (nonatomic, strong, readwrite) nsinputstream *   filestream; @property (nonatomic, assign, readonly ) uint8_t *         buffer; @property (nonatomic, assign, readwrite) size_t            bufferoffset; @property (nonatomic, assign, readwrite) size_t            bufferlimit; @end  @implementation viewcontroller {     uint8_t                     _buffer[ksendbuffersize]; } - (void)viewdidload {     [super viewdidload];     [self.sendbutton setenabled:yes];     [self.pausebutton setenabled:no];     [self.playbutton setenabled: no];      //define file path, file pointer/url     // nsarray *pathcomponents = [nsarray arraywithobjects:[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject], @"myaudio.m4a", nil];     // nsurl *outputfileurl = [nsurl fileurlwithpathcomponents:pathcomponents];      nsarray *searchpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);     nsstring *documentpath_ = [searchpaths objectatindex:0];     nsstring *pathtosave = [documentpath_ stringbyappendingpathcomponent: @"myaudio2.m4a"];     nsurl *outputfileurl = [nsurl fileurlwithpath: pathtosave];      //setup audio session     avaudiosession *session = [avaudiosession sharedinstance];     [session setcategory:avaudiosessioncategoryplayandrecord error:nil];      //define record settings     nsmutabledictionary *recordsetting = [[nsmutabledictionary alloc] init];     //codec/format     [recordsetting setvalue:[nsnumber numberwithint:kaudioformatmpeg4aac] forkey:avformatidkey];     //bit rate     [recordsetting setvalue:[nsnumber numberwithfloat:44100.0] forkey:avsampleratekey]; //8000     //number of channels - stero -2 mono -1?     [recordsetting setvalue:[nsnumber numberwithint: 2] forkey:avnumberofchannelskey];      //initiate , prepare recorder     recorder = [[avaudiorecorder alloc] initwithurl:outputfileurl settings:recordsetting error:null];      recorder.delegate = self;     recorder.meteringenabled = yes;     [recorder preparetorecord]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }     - (ibaction)sendbuttonpush:(id)sender {     self.status.text = @"...";     [self.sendbutton setenabled:no];      nsarray *searchpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);     nsstring *documentpath_ = [searchpaths objectatindex:0];     nsstring *pathtosave = [documentpath_ stringbyappendingpathcomponent: @"myaudio2.m4a"];     //nsurl *outputfileurl = [nsurl fileurlwithpath: pathtosave];     nslog(@"path: %@", pathtosave);     [self startsend: pathtosave]; }   /*  * imported simpleftpsample - dev.apple.com  */ - (void)senddidstart {     self.status.text = @"sending";     //self.cancelbutton.enabled = yes;     //[self.activityindicator startanimating];     [[networkmanager sharedinstance] didstartnetworkoperation]; }  - (void)updatestatus:(nsstring *)statusstring {     assert(statusstring != nil);     self.status.text = statusstring; }  - (void)senddidstopwithstatus:(nsstring *)statusstring {     if (statusstring == nil) {         statusstring = @"put succeeded";     }     self.status.text = statusstring;     //self.cancelbutton.enabled = no;     //[self.activityindicator stopanimating];     [[networkmanager sharedinstance] didstopnetworkoperation]; }  #pragma mark * core transfer code  // code networking.  // because buffer declared array, have use custom getter. // synthesised getter doesn't compile.  - (uint8_t *)buffer {     return self->_buffer; }  - (bool)issending {     return (self.networkstream != nil); }  - (void)startsend:(nsstring *)filepath {     bool                    success;     nsurl *                 url;      //check path not empty     assert(filepath != nil);     //check path exists     assert([[nsfilemanager defaultmanager] fileexistsatpath:filepath]);     //check file either png or jpg     nslog(@"filepath: %@", filepath);     //assert( [filepath.pathextension isequal:@"png"] || [filepath.pathextension isequal:@"jpg"] );      assert(self.networkstream == nil);      // don't tap send twice in row!     assert(self.filestream == nil);         // ditto      // first , check url - insert our custom url here!     url = [[networkmanager sharedinstance] smarturlforstring:@"ftp://www.example.co.uk"];     //check     success = (url != nil);      if (success) {         // add last part of file name end of url form final         // url we're going put to.          url = cfbridgingrelease(                                 cfurlcreatecopyappendingpathcomponent(null, (__bridge cfurlref) url, (__bridge cfstringref) [filepath lastpathcomponent], false)                                 );         success = (url != nil);     }      // if url bogus, let user know.  otherwise kick off connection.     nslog(@"url %@", url);     if ( ! success) {         self.status.text = @"invalid url";     } else {          // open stream file we're going send.  not open stream;         // nsurlconnection us.          self.filestream = [nsinputstream inputstreamwithfileatpath:filepath];         assert(self.filestream != nil);         //open file stream input         [self.filestream open];          // open cfftpstream url.          self.networkstream = cfbridgingrelease(                                                cfwritestreamcreatewithftpurl(null, (__bridge cfurlref) url)                                                );         assert(self.networkstream != nil);         //         //user & password         //             success = [self.networkstream setproperty:@"username" forkey:(id)kcfstreampropertyftpusername];             assert(success);             success = [self.networkstream setproperty:@"password" forkey:(id)kcfstreampropertyftppassword];             assert(success);           self.networkstream.delegate = self;         [self.networkstream scheduleinrunloop:[nsrunloop currentrunloop] formode:nsdefaultrunloopmode];         [self.networkstream open];          // tell ui we're sending.          [self senddidstart];     } }  - (void)stopsendwithstatus:(nsstring *)statusstring {     if (self.networkstream != nil) {         [self.networkstream removefromrunloop:[nsrunloop currentrunloop] formode:nsdefaultrunloopmode];         self.networkstream.delegate = nil;         [self.networkstream close];         self.networkstream = nil;     }     if (self.filestream != nil) {         [self.filestream close];         self.filestream = nil;     }     [self senddidstopwithstatus:statusstring]; }  - (void)stream:(nsstream *)astream handleevent:(nsstreamevent)eventcode // nsstream delegate callback that's called when events happen on our // network stream. { #pragma unused(astream)     assert(astream == self.networkstream);      switch (eventcode) {         case nsstreameventopencompleted: {             [self updatestatus:@"opened connection"];         } break;         case nsstreameventhasbytesavailable: {             assert(no);     // should never happen output stream         } break;         case nsstreameventhasspaceavailable: {             [self updatestatus:@"sending"];              // if don't have data buffered, go read next chunk of data.              if (self.bufferoffset == self.bufferlimit) {                 nsinteger   bytesread;                  bytesread = [self.filestream read:self.buffer maxlength:ksendbuffersize];                  if (bytesread == -1) {                     [self stopsendwithstatus:@"file read error"];                 } else if (bytesread == 0) {                     [self stopsendwithstatus:nil];                 } else {                     self.bufferoffset = 0;                     self.bufferlimit  = bytesread;                 }             }              // if we're not out of data completely, send next chunk.              if (self.bufferoffset != self.bufferlimit) {                 nsinteger   byteswritten;                 byteswritten = [self.networkstream write:&self.buffer[self.bufferoffset] maxlength:self.bufferlimit - self.bufferoffset];                 assert(byteswritten != 0);                 if (byteswritten == -1) {                     [self stopsendwithstatus:@"network write error"];                 } else {                     self.bufferoffset += byteswritten;                 }             }         } break;         case nsstreameventerroroccurred: {             [self stopsendwithstatus:@"stream open error"];         } break;         case nsstreameventendencountered: {             // ignore         } break;         default: {             assert(no);         } break;     } }    - (void)viewwillappear:(bool)animated {     [super viewwillappear:animated]; }  - (void)viewdidunload {     [super viewdidunload]; }  - (void)dealloc {     [self stopsendwithstatus:@"stopped"]; } - (ibaction)recordbuttontapped:(id)sender {     if(player.playing){         [player stop];     }      if(!recorder.recording){         avaudiosession *session = [avaudiosession sharedinstance];         [session setactive: yes error: nil];         //start recording         self.startdate = [nsdate date];         self.timer = [nstimer scheduledtimerwithtimeinterval:1.0/100.0                                                       target:self                                                     selector:@selector(updatetimer)                                                     userinfo:nil                                                      repeats:yes];         [recorder record];           [self.recordbutton settitle: @"pause" forstate:uicontrolstatenormal];      } else{         [recorder pause];         [self.recordbutton settitle:@"record" forstate: uicontrolstatenormal];         [self.timer invalidate];         self.timer = nil;         [self updatetimer];     }     [self.pausebutton setenabled:yes];     [self.playbutton setenabled:no]; }  //ui functions - (ibaction)pausebuttontapped:(id)sender {     [recorder stop];     avaudiosession *audiosession = [avaudiosession sharedinstance];     [audiosession setactive:no error: nil];  /*   nsarray *searchpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);     nsstring *documentpath_ = [searchpaths objectatindex:0];     nsfilemanager *filemanager = [nsfilemanager defaultmanager];     nsmutablearray *arraylist =[[nsmutablearray alloc] initwitharray:[filemanager contentsofdirectoryatpath:documentpath_ error:nil]];     nslog(@"==== %@", arraylist); */ }  - (ibaction)playbuttontapped:(id)sender {     if(!recorder.recording){         player = [[avaudioplayer alloc] initwithcontentsofurl:recorder.url error:nil];         [player setdelegate:self];         [player play];     } }  //audio functions -(void) audiorecorderdidfinishrecording:(avaudiorecorder *)recorder successfully:(bool)flag{     [self.recordbutton settitle: @"record" forstate:uicontrolstatenormal];     [self.pausebutton setenabled:no];     [self.playbutton setenabled:yes]; }  -(void) audioplayerdidfinishplaying:(avaudioplayer *)player successfully:(bool)flag{     uialertview *alert = [[uialertview alloc] initwithtitle:@"done" message:@"finished playing recording!" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles: nil];     [alert show]; }  //timer function -(void) updatetimer {       // create date elapsed time     nsdate *currentdate = [nsdate date];     nstimeinterval timeinterval = [currentdate timeintervalsincedate:self.startdate];     nsdate *timerdate = [nsdate datewithtimeintervalsince1970:timeinterval];      // create date formatter     nsdateformatter *dateformatter = [[nsdateformatter alloc] init];     [dateformatter setdateformat:@"mm:ss.ss"];     [dateformatter settimezone:[nstimezone timezoneforsecondsfromgmt:0.0]];      // format elapsed time , set label     nsstring *timestring = [dateformatter stringfromdate:timerdate];     self.time.text = timestring; }  @end 

in

in window button, delete connections, , add them again.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -