ios7 - captureOutput:didOutputMetadataObjects:fromConnection: Deleagate firing Multiple times -



ios7 - captureOutput:didOutputMetadataObjects:fromConnection: Deleagate firing Multiple times -

captureoutput:didoutputmetadataobjects:fromconnection: deleagate firing multiple times. need pass scanned value server multiple calls happens server 1 scan

here same question delegate method beingness invoked multiple times, after returning view

as apple documentation says : "this method may called frequently, implementation should efficient prevent capture performance problems, including dropped metadata objects".

handle multiple invoke next :

- (void)captureoutput:(avcaptureoutput *)captureoutput didoutputmetadataobjects:(nsarray *)metadataobjects fromconnection:(avcaptureconnection *)connection { id captureddata; if ([metadataobjects count] > 0) { // handle captured info here [self performselectoronmainthread:@selector(stopreading:) withobject:captureddata waituntildone:no]; } }

the stopreading: method looks (assuming _session avcapturesession object , _prevlayer avcapturevideopreviewlayer used earlier) :

-(void)stopreading:(id) data{ nslog(@"stop reading"); [_session stoprunning]; _session = nil; [_prevlayer removefromsuperlayer]; // want captured info [self.delegate didscanbarcodewithcontext:data]; }

ios7 avfoundation

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -