react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

call keep crash : index 0 beyond bounds for empty array

Open fukemy opened this issue 1 year ago • 3 comments

Bug report

  • [x] I've checked the example to reproduce the issue.

  • Reproduced on:

  • [ ] Android

  • [x] iOS

Description

Fatal Exception: NSRangeException *** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty array

Steps to Reproduce

answer the call then got this error

Versions

- Callkeep: 4.3.12
- React Native: 0.72.5
- iOS: 17.0.3
- Android: NO
- Phone model: IOS

Logs

Fatal Exception: NSRangeException
*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty array
0
CoreFoundation
__exceptionPreprocess
2
CoreFoundation
-[__NSArray0 objectEnumerator]
3
VedaxLink
RNCallKeep.m - Line 182
+[RNCallKeep getAudioOutput] + 182
4
VedaxLink
RNCallKeep.m - Line 141
-[RNCallKeep onAudioRouteChange:] + 141
5
CoreFoundation
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
20
UIKitCore
UIApplicationMain
21
VedaxLink
main.m - Line 8
main + 8
22
(Missing)

fukemy avatar Dec 22 '23 09:12 fukemy

any solution????????

fukemy avatar Jan 23 '24 02:01 fukemy

Same issue here

CaptainJeff avatar Feb 13 '24 15:02 CaptainJeff

@CaptainJeff use my code to solve this:

+ (NSString *) getAudioOutput {
//    return [AVAudioSession sharedInstance].currentRoute.outputs.count > 0 ? [AVAudioSession sharedInstance].currentRoute.outputs[0].portType : nil;
    @try{
        NSArray<AVAudioSessionPortDescription *>* outputs = [AVAudioSession sharedInstance].currentRoute.outputs;
        if(outputs != nil && outputs.count > 0){
            return outputs[0].portType;
        }
        return nil;
    }@catch(NSException* anException) {
        NSLog(@"getAudioOutput error :%@", [anException description]);
        return nil;
    }
}

fukemy avatar Feb 15 '24 01:02 fukemy

We are getting same issue,

h4rshil avatar Apr 16 '24 11:04 h4rshil