@@ -86,13 +86,13 @@ - (IBAction)deleteRecording:(id)sender {
8686#pragma
8787#pragma mark - Voice Recording
8888
89- - (IBAction ) startRecording {
89+ - (IBAction ) startRecording {
9090 [self performSelectorInBackground: @selector (performRecording ) withObject: nil ];
9191}
9292
93- -(void ) performRecording {
93+ -(void ) performRecording {
9494
95- if (!isRecording){
95+ if (!isRecording) {
9696 [[NSOperationQueue mainQueue ] addOperationWithBlock: ^ {
9797 [self .recordBarButton setImage: [UIImage imageNamed: @" stop" ] forState: UIControlStateNormal];
9898 }];
@@ -111,12 +111,12 @@ -(void) performRecording{
111111 }
112112 [audioSession setActive: YES error: &err];
113113 err = nil ;
114- if (err){
114+ if (err) {
115115 NSLog (@" audioSession: %@ %ld %@ " , [err domain ], (long )[err code ], [[err userInfo ] description ]);
116116 return ;
117117 }
118- NSMutableDictionary *settings = [[NSMutableDictionary alloc ] initWithCapacity: 0 ];
119118
119+ NSMutableDictionary *settings = [[NSMutableDictionary alloc ] initWithCapacity: 0 ];
120120 [settings setValue :[NSNumber numberWithInt: kAudioFormatMPEG4AAC ] forKey: AVFormatIDKey];
121121 [settings setValue: [NSNumber numberWithFloat: 8000.0 ] forKey: AVSampleRateKey];
122122 [settings setValue: [NSNumber numberWithInt: 1 ] forKey: AVNumberOfChannelsKey];
@@ -177,9 +177,13 @@ -(void) performRecording{
177177 // start recording
178178 [self .recorder record ];
179179
180- }else {
180+ } else {
181181 isRecording = NO ;
182- [self .recordBarButton setImage: [UIImage imageNamed: @" record" ] forState: UIControlStateNormal];
182+
183+ [[NSOperationQueue mainQueue ] addOperationWithBlock: ^ {
184+ [self .recordBarButton setImage: [UIImage imageNamed: @" record" ] forState: UIControlStateNormal];
185+ }];
186+
183187 [self .recorder stop ];
184188 if (_sliderTimer != nil && _sliderTimer.isValid ) {
185189 [_sliderTimer invalidate ];
0 commit comments