我有同樣的問題LLSimpleCamera,與此代碼
@property(readonly, strong, nonatomic) LLSimpleCamera *camera;
//...
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
[[self camera] startRecordingWithOutputUrl:path didRecord:^(LLSimpleCamera *camera, NSURL *outputFileUrl, NSError *error)
{ /*do something*/ }
當我設置類別調用startRecordingWithOutputUrl:
以前更多更早的問題不會出現。所以,在setCategory:
後面加一些代碼並檢查。 我知道這不是一個「真正的」解決方案,但它在6個小時的努力工作後對我有用。
[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
/* do some UI-related stuff, hide buttons, show bars, some animation */
[[self camera] startRecordingWithOutputUrl:path didRecord:^(LLSimpleCamera *camera, NSURL *outputFileUrl, NSError *error)
{ /*do something*/ }
附註:
無法使用此代碼重現問題轉載僅限iPhone 7
@KiritModi檢查代碼字符串,它的目標是c – Sonu