ReSwift-Recorder icon indicating copy to clipboard operation
ReSwift-Recorder copied to clipboard

unexpectedly found nil while unwrapping an Optional value in TypeMaps

Open seyhunak opened this issue 9 years ago • 0 comments

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

seyhunak avatar Oct 14 '16 19:10 seyhunak