No ObservableObject of type Store<AppState, AppAction, World> found. A View.environmentObject(_:) for Store<AppState, AppAction, World> may be missing as an ancestor of this view.: file SwiftUI, line 0
sm0nster opened this issue · 10 comments
Hey, I've read the article (kudos for it) and tried to play around with your structure but I'm getting fatal error when trying to get to recipe details from recipes listing:
Fatal error: No ObservableObject of type Store<AppState, AppAction, World> found. A View.environmentObject(_:) for Store<AppState, AppAction, World> may be missing as an ancestor of this view.: file SwiftUI, line 0
2020-04-05 17:40:38.374178+0200 Recipes[3256:60476] Fatal error: No ObservableObject of type Store<AppState, AppAction, World> found. A View.environmentObject(_:) for Store<AppState, AppAction, World> may be missing as an ancestor of this view.: file SwiftUI, line 0
Do you know maybe what is causing the problem?
@sm0nster Hi, could you please show me code that raises the error? Usually, we have this error when forget to pass EnvironmentObject.
Recipes/Features/Recipes/RecipesContainerView.swift:16:
private var recipes: [Recipe] {
store.state.recipes.compactMap {
store.state.allRecipes[$0]
}
}
Sorry I didn't attach it earlier but I'm using AppCode, and this showed up after I have run it in Xcode.
@sm0nster I've just tried to clone the repo and it worked normally. Could you please try again?
@mecid I've cloned the repo again, run it and first, when I tapped "breakfast" it opened details controller with infinite loader, I tapped "back" and now when I'm trying to tap any meal type I get same error :/
Hi,
I may be experiencing the same issue. I tap Breakfast (or any category) and the next screen just hangs. Repo is freshly cloned. I also tried creating my own api creds at edamam.com in case that was the issue, but that didnt help. Perhaps the fetch request isnt completing and causing an issue? I'm still getting familiar with Combine and Xcode debugging unfortunately, hence no solution and pr.
Xcode Version 11.4 (11E146)
Any ideas? Or additional info I can provide?
@panckreous @sm0nster try to switch the filter to vegan recipes.
confirmed working as expected with Vegan and Vegetarian.