element-ios icon indicating copy to clipboard operation
element-ios copied to clipboard

Application crashing because NSException not handled

Open NicolasBuquet opened this issue 2 years ago • 2 comments

In class MatrixSDK/Core/MXKeyProvider, the method - (nonnull MXKeyData *)keyDataForDataOfType:(NSString *)dataType raise Excpetion that doesn't seem to be always catched:

- (nonnull MXKeyData *)keyDataForDataOfType:(NSString *)dataType
                                isMandatory:(BOOL)isMandatory
                            expectedKeyType:(MXKeyType)keyType
{
    MXKeyData *keyData = [self.delegate keyDataForDataOfType:dataType];
    
    if (!keyData && isMandatory)
    {
        [NSException raise:@"MandatoryKey" format:@"No key value for mandatory Key (data type : %@)", dataType];
    }

    if (keyData && keyData.type != keyType)
    {
        [NSException raise:@"KeyType" format:@"Wrong key type (%lu expected %lu) for data of type : %@", keyData.type, keyType, dataType];
    }

    return keyData;
}

I think it causes crash when exiting application from background state.

Operating system version

iOS 16.3.1

Application version

Element Rebase 1.10.4

Homeserver

Tchap HomeServer

Will you send logs?

No

NicolasBuquet avatar Mar 30 '23 17:03 NicolasBuquet

In my case exception generated when self.delegate is nil. Any idea?

mehroozkhan50 avatar Jul 21 '23 10:07 mehroozkhan50

@NicolasBuquet you can set delegate. I set It according to element . now it's working fine.

mehroozkhan50 avatar Jul 21 '23 12:07 mehroozkhan50