awslabs / amazon-kinesis-video-streams-webrtc-sdk-ios

iOS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
66 stars 29 forks source link

Fatal error: Unexpectedly found nil #24

Closed bad-hambo closed 3 years ago

bad-hambo commented 3 years ago

Hi:

I am building the sample app and have gone through all instructions provided in the github. I am getting to the login page but it seems I encounter the error below; I've done this with a pre-populated user in my user group in addition to a confirmed new user through the app. It crashes when I use the tap the Sign In button. Please advise; I am hoping to leverage kinesis to stream video iOS devices.

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file AWSMobileClient/AWSMobileClientExtensions.swift, line 226
2020-12-07 22:33:43.768920-0800 AWSKinesisVideoWebRTCDemoApp[588:182775] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file AWSMobileClient/AWSMobileClientExtensions.swift, line 226

Piece of code where it fails:

user!.getSession(username,      // Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value 
     password: password,
     validationData: validationAttributes,
     clientMetaData: clientMetaData,
     isInitialCustomChallenge: isCustomAuth).continueWith { (task) -> Any? in
dswamina commented 3 years ago

Hi,

Can you tell us the device and iOS version you're testing the sample on?

bad-hambo commented 3 years ago

Hi:

iPad Pro 12.9" running on iOS 13.5.1

MushMal commented 3 years ago

@bad-hambo would you please upload the full logs and the stack info. @dswamina can you take a look at this once the logs are uploaded?

bad-hambo commented 3 years ago

Hi:

Below are the debug logs; let me know if you need anything further.

    The user is signedOut.
    2020-12-08 17:51:23.169073-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] [Storyboard] Unknown class zz in Interface Builder file.
    2020-12-08 17:51:23.183340-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] [LayoutConstraints] Unable to simultaneously satisfy constraints.
        Probably at least one of the constraints in the following list is one you don't want. 
        Try this: 
            (1) look at each constraint and try to figure out which you don't expect; 
            (2) find the code that added the unwanted constraint or constraints and fix it. 
    (
        "<NSLayoutConstraint:0x281708a00 clientidtextfield.width == 250   (active, names: clientidtextfield:0x102860200 )>",
        "<NSLayoutConstraint:0x281774be0 UIStackView:0x101d130e0.centerX == UIView:0x101d12f70.centerX   (active)>",
        "<NSLayoutConstraint:0x281774c80 UIStackView:0x101d130e0.leading == UIView:0x101d12f70.leadingMargin + 50   (active)>",
        "<NSLayoutConstraint:0x28170c410 'UISV-alignment' channelnametextfield.leading == clientidtextfield.leading   (active, names: channelnametextfield:0x102857800, clientidtextfield:0x102860200 )>",
        "<NSLayoutConstraint:0x28170c5a0 'UISV-alignment' channelnametextfield.trailing == clientidtextfield.trailing   (active, names: channelnametextfield:0x102857800, clientidtextfield:0x102860200 )>",
        "<NSLayoutConstraint:0x28170c370 'UISV-canvas-connection' UIStackView:0x101d130e0.leading == channelnametextfield.leading   (active, names: channelnametextfield:0x102857800 )>",
        "<NSLayoutConstraint:0x28170c3c0 'UISV-canvas-connection' H:[channelnametextfield]-(0)-|   (active, names: channelnametextfield:0x102857800, '|':UIStackView:0x101d130e0 )>",
        "<NSLayoutConstraint:0x28170c780 'UIView-Encapsulated-Layout-Width' UIView:0x101d12f70.width == 1024   (active)>",
        "<NSLayoutConstraint:0x281774dc0 'UIView-leftMargin-guide-constraint' H:|-(20)-[UILayoutGuide:0x280d40700'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x101d12f70 )>"
    )

    Will attempt to recover by breaking constraint 
    <NSLayoutConstraint:0x281708a00 clientidtextfield.width == 250   (active, names: clientidtextfield:0x102860200 )>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    2020-12-08 17:51:23.184054-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] [LayoutConstraints] Unable to simultaneously satisfy constraints.
        Probably at least one of the constraints in the following list is one you don't want. 
        Try this: 
            (1) look at each constraint and try to figure out which you don't expect; 
            (2) find the code that added the unwanted constraint or constraints and fix it. 
    (
        "<NSLayoutConstraint:0x281708aa0 channelnametextfield.width == 250   (active, names: channelnametextfield:0x102857800 )>",
        "<NSLayoutConstraint:0x281774be0 UIStackView:0x101d130e0.centerX == UIView:0x101d12f70.centerX   (active)>",
        "<NSLayoutConstraint:0x281774c80 UIStackView:0x101d130e0.leading == UIView:0x101d12f70.leadingMargin + 50   (active)>",
        "<NSLayoutConstraint:0x28170c370 'UISV-canvas-connection' UIStackView:0x101d130e0.leading == channelnametextfield.leading   (active, names: channelnametextfield:0x102857800 )>",
        "<NSLayoutConstraint:0x28170c3c0 'UISV-canvas-connection' H:[channelnametextfield]-(0)-|   (active, names: channelnametextfield:0x102857800, '|':UIStackView:0x101d130e0 )>",
        "<NSLayoutConstraint:0x28170c780 'UIView-Encapsulated-Layout-Width' UIView:0x101d12f70.width == 1024   (active)>",
        "<NSLayoutConstraint:0x281774dc0 'UIView-leftMargin-guide-constraint' H:|-(20)-[UILayoutGuide:0x280d40700'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x101d12f70 )>"
    )

    Will attempt to recover by breaking constraint 
    <NSLayoutConstraint:0x281708aa0 channelnametextfield.width == 250   (active, names: channelnametextfield:0x102857800 )>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    2020-12-08 17:51:23.184888-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] [LayoutConstraints] Unable to simultaneously satisfy constraints.
        Probably at least one of the constraints in the following list is one you don't want. 
        Try this: 
            (1) look at each constraint and try to figure out which you don't expect; 
            (2) find the code that added the unwanted constraint or constraints and fix it. 
    (
        "<NSLayoutConstraint:0x281774be0 UIStackView:0x101d130e0.centerX == UIView:0x101d12f70.centerX   (active)>",
        "<NSLayoutConstraint:0x281774c80 UIStackView:0x101d130e0.leading == UIView:0x101d12f70.leadingMargin + 50   (active)>",
        "<NSLayoutConstraint:0x2817085f0 connectasmasterbutton.width == 200   (active, names: connectasmasterbutton:0x101c27040 )>",
        "<NSLayoutConstraint:0x28170c460 'UISV-alignment' channelnametextfield.leading == connectasmasterbutton.leading   (active, names: channelnametextfield:0x102857800, connectasmasterbutton:0x101c27040 )>",
        "<NSLayoutConstraint:0x28170c640 'UISV-alignment' channelnametextfield.trailing == connectasmasterbutton.trailing   (active, names: channelnametextfield:0x102857800, connectasmasterbutton:0x101c27040 )>",
        "<NSLayoutConstraint:0x28170c370 'UISV-canvas-connection' UIStackView:0x101d130e0.leading == channelnametextfield.leading   (active, names: channelnametextfield:0x102857800 )>",
        "<NSLayoutConstraint:0x28170c3c0 'UISV-canvas-connection' H:[channelnametextfield]-(0)-|   (active, names: channelnametextfield:0x102857800, '|':UIStackView:0x101d130e0 )>",
        "<NSLayoutConstraint:0x28170c780 'UIView-Encapsulated-Layout-Width' UIView:0x101d12f70.width == 1024   (active)>",
        "<NSLayoutConstraint:0x281774dc0 'UIView-leftMargin-guide-constraint' H:|-(20)-[UILayoutGuide:0x280d40700'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x101d12f70 )>"
    )

    Will attempt to recover by breaking constraint 
    <NSLayoutConstraint:0x2817085f0 connectasmasterbutton.width == 200   (active, names: connectasmasterbutton:0x101c27040 )>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    2020-12-08 17:51:23.732632-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] SignIn : viewDidAppear
    2020-12-08 17:51:32.062442-0800 AWSKinesisVideoWebRTCDemoApp[617:200253] [general] Connection to daemon was invalidated
    2020-12-08 17:51:35.579042-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] [Snapshotting] Snapshotting a view (0x104b179b0, _UIReplicantView) that has not been rendered at least once requires afterScreenUpdates:YES.
    2020-12-08 17:51:39.917523-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] [Snapshotting] Snapshotting a view (0x104a20430, _UIReplicantView) that has not been rendered at least once requires afterScreenUpdates:YES.
    Fatal error: Unexpectedly found nil while unwrapping an Optional value: file AWSMobileClient/AWSMobileClientExtensions.swift, line 226
    2020-12-08 17:51:42.599764-0800 AWSKinesisVideoWebRTCDemoApp[617:200080] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file AWSMobileClient/AWSMobileClientExtensions.swift, line 226
    (lldb) 
MushMal commented 3 years ago

Seems like a crash in AWS mobile client and not the demo app.

Can you check this out: https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-ios/issues/4

MushMal commented 3 years ago

Update please?

bad-hambo commented 3 years ago

@MushMal hey, checking out the suggestion.

bad-hambo commented 3 years ago

@MushMal hi, I've resolved the issue with nil error; now I'm facing a different issue with Login Error:

Login Error
There was an error with your login: The operation couldn't be completed. (AWSMobileClient.AWSMobileClientError error 13.)

Below is a paste of log from XCode:

    The user is signedOut.
    2020-12-09 14:29:57.921210-0800 AWSKinesisVideoWebRTCDemoApp[1474:574393] [Storyboard] Unknown class zz in Interface Builder file.
    2020-12-09 14:29:57.929953-0800 AWSKinesisVideoWebRTCDemoApp[1474:574393] [LayoutConstraints] Unable to simultaneously satisfy constraints.
        Probably at least one of the constraints in the following list is one you don't want. 
        Try this: 
            (1) look at each constraint and try to figure out which you don't expect; 
            (2) find the code that added the unwanted constraint or constraints and fix it. 
    (
        "<NSLayoutConstraint:0x28276c500 clientidtextfield.width == 250   (active, names: clientidtextfield:0x140817dc0 )>",
        "<NSLayoutConstraint:0x28276e210 UIStackView:0x140822480.centerX == UIView:0x140822060.centerX   (active)>",
        "<NSLayoutConstraint:0x28276e2b0 UIStackView:0x140822480.leading == UIView:0x140822060.leadingMargin + 50   (active)>",
        "<NSLayoutConstraint:0x2827716d0 'UISV-alignment' channelnametextfield.leading == clientidtextfield.leading   (active, names: channelnametextfield:0x1408162d0, clientidtextfield:0x140817dc0 )>",
        "<NSLayoutConstraint:0x282771860 'UISV-alignment' channelnametextfield.trailing == clientidtextfield.trailing   (active, names: channelnametextfield:0x1408162d0, clientidtextfield:0x140817dc0 )>",
        "<NSLayoutConstraint:0x282771630 'UISV-canvas-connection' UIStackView:0x140822480.leading == channelnametextfield.leading   (active, names: channelnametextfield:0x1408162d0 )>",
        "<NSLayoutConstraint:0x282771680 'UISV-canvas-connection' H:[channelnametextfield]-(0)-|   (active, names: channelnametextfield:0x1408162d0, '|':UIStackView:0x140822480 )>",
        "<NSLayoutConstraint:0x282771a40 'UIView-Encapsulated-Layout-Width' UIView:0x140822060.width == 414   (active)>",
        "<NSLayoutConstraint:0x28276e3f0 'UIView-leftMargin-guide-constraint' H:|-(20)-[UILayoutGuide:0x283d5a3e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x140822060 )>"
    )

    Will attempt to recover by breaking constraint 
    <NSLayoutConstraint:0x28276c500 clientidtextfield.width == 250   (active, names: clientidtextfield:0x140817dc0 )>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    2020-12-09 14:29:57.930419-0800 AWSKinesisVideoWebRTCDemoApp[1474:574393] [LayoutConstraints] Unable to simultaneously satisfy constraints.
        Probably at least one of the constraints in the following list is one you don't want. 
        Try this: 
            (1) look at each constraint and try to figure out which you don't expect; 
            (2) find the code that added the unwanted constraint or constraints and fix it. 
    (
        "<NSLayoutConstraint:0x28276c5a0 channelnametextfield.width == 250   (active, names: channelnametextfield:0x1408162d0 )>",
        "<NSLayoutConstraint:0x28276e210 UIStackView:0x140822480.centerX == UIView:0x140822060.centerX   (active)>",
        "<NSLayoutConstraint:0x28276e2b0 UIStackView:0x140822480.leading == UIView:0x140822060.leadingMargin + 50   (active)>",
        "<NSLayoutConstraint:0x282771630 'UISV-canvas-connection' UIStackView:0x140822480.leading == channelnametextfield.leading   (active, names: channelnametextfield:0x1408162d0 )>",
        "<NSLayoutConstraint:0x282771680 'UISV-canvas-connection' H:[channelnametextfield]-(0)-|   (active, names: channelnametextfield:0x1408162d0, '|':UIStackView:0x140822480 )>",
        "<NSLayoutConstraint:0x282771a40 'UIView-Encapsulated-Layout-Width' UIView:0x140822060.width == 414   (active)>",
        "<NSLayoutConstraint:0x28276e3f0 'UIView-leftMargin-guide-constraint' H:|-(20)-[UILayoutGuide:0x283d5a3e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x140822060 )>"
    )

    Will attempt to recover by breaking constraint 
    <NSLayoutConstraint:0x28276c5a0 channelnametextfield.width == 250   (active, names: channelnametextfield:0x1408162d0 )>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    2020-12-09 14:29:57.930804-0800 AWSKinesisVideoWebRTCDemoApp[1474:574393] [LayoutConstraints] Unable to simultaneously satisfy constraints.
        Probably at least one of the constraints in the following list is one you don't want. 
        Try this: 
            (1) look at each constraint and try to figure out which you don't expect; 
            (2) find the code that added the unwanted constraint or constraints and fix it. 
    (
        "<NSLayoutConstraint:0x28276e210 UIStackView:0x140822480.centerX == UIView:0x140822060.centerX   (active)>",
        "<NSLayoutConstraint:0x28276e2b0 UIStackView:0x140822480.leading == UIView:0x140822060.leadingMargin + 50   (active)>",
        "<NSLayoutConstraint:0x28276c0f0 connectasmasterbutton.width == 200   (active, names: connectasmasterbutton:0x140818bc0 )>",
        "<NSLayoutConstraint:0x282771720 'UISV-alignment' channelnametextfield.leading == connectasmasterbutton.leading   (active, names: channelnametextfield:0x1408162d0, connectasmasterbutton:0x140818bc0 )>",
        "<NSLayoutConstraint:0x282771900 'UISV-alignment' channelnametextfield.trailing == connectasmasterbutton.trailing   (active, names: channelnametextfield:0x1408162d0, connectasmasterbutton:0x140818bc0 )>",
        "<NSLayoutConstraint:0x282771630 'UISV-canvas-connection' UIStackView:0x140822480.leading == channelnametextfield.leading   (active, names: channelnametextfield:0x1408162d0 )>",
        "<NSLayoutConstraint:0x282771680 'UISV-canvas-connection' H:[channelnametextfield]-(0)-|   (active, names: channelnametextfield:0x1408162d0, '|':UIStackView:0x140822480 )>",
        "<NSLayoutConstraint:0x282771a40 'UIView-Encapsulated-Layout-Width' UIView:0x140822060.width == 414   (active)>",
        "<NSLayoutConstraint:0x28276e3f0 'UIView-leftMargin-guide-constraint' H:|-(20)-[UILayoutGuide:0x283d5a3e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x140822060 )>"
    )

    Will attempt to recover by breaking constraint 
    <NSLayoutConstraint:0x28276c0f0 connectasmasterbutton.width == 200   (active, names: connectasmasterbutton:0x140818bc0 )>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    2020-12-09 14:29:58.461206-0800 AWSKinesisVideoWebRTCDemoApp[1474:574393] SignIn : viewDidAppear
    2020-12-09 14:30:10.311361-0800 AWSKinesisVideoWebRTCDemoApp[1474:574407] [Client] Updating selectors after delegate removal failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 86 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 86 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
    2020-12-09 14:30:10.620889-0800 AWSKinesisVideoWebRTCDemoApp[1474:574408] [Client] Updating selectors after delegate removal failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 86 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 86 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
    2020-12-09 14:31:10.970702-0800 AWSKinesisVideoWebRTCDemoApp[1474:574516] [tcp] tcp_input [C1.1:3] flags=[R] seq=3502157537, ack=0, win=0 state=LAST_ACK rcv_nxt=3502157537, snd_una=689916532
bad-hambo commented 3 years ago

Update:

Further googling and resolved issues; seems to be a bug in the AWSMobileClient SDK. Had to generate an additional user through the sign up UI to have it working. Cheers.

18295718240 commented 3 years ago

How to solve the problem of getting channel endpoint error,