Skip to content

unexpectedly found nil while unwrapping an Optional value in TypeMaps #8

@seyhunak

Description

@seyhunak

Hello,

I was getting "unexpectedly found nil while unwrapping an Optional value". in ReSwift-Recorder
What is the problem in code below?

AppDelegate

var store = RecordingMainStore<BaseState>(
    reducer: BaseReducer(),
    state: nil,
    typeMaps:[accountsActionTypeMap, ReSwiftRouter.typeMap],
    recording: "recording.json"
)

Actions

let accountsActionTypeMap: TypeMap = [AccountsListAction.type: AccountsListAction.self,
                                      AccountDetailAction.type: AccountDetailAction.self,
                                      AccountIdentifierAction.type: AccountIdentifierAction.self]

struct AccountsListAction: StandardActionConvertible {
    static let type = "ACCOUNTS_LIST_ACTION"
    var accounts: [IdentifiersResponse]?
    init(accounts: [IdentifiersResponse]) { self.accounts = accounts }

    init() {}
    init(_ standardAction: StandardAction) {
        self.accounts = [IdentifiersResponse]()
    }

    func toStandardAction() -> StandardAction {
        return StandardAction(type: AccountsListAction.type,
                              payload: ["accounts": accounts as! AnyObject],
                              isTypedAction: true)
    }
}

Stack trace (RecordingStore.swift: 145)

screen shot 2016-10-14 at 22 15 33

Using ReSwift (2.1.0)
Using ReSwiftRecorder (0.3.0)
Using ReSwiftRouter (0.3.0)

Xcode 7.3
Swift 2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions