I have the same issue and noticed that my In-app purchase is still "in review". I assumed that app approval and in-app purchase approval was the same integrated process, but if not, then that could explain it.
If so, the team reviewing my app are testing on a separate Sandbox environment without access to my "sandbox purchase". They also can't get any real purchases, because the other team haven't approved it yet, and they are therefore getting nothing back.
I'm just guessing here obviously, but I've suggested this explanation to the reviewers, so hopefully they can confirm one way or the other.
Post
Replies
Boosts
Views
Activity
Did you ever figure this out? I'm stuck on similar issue now.
I solved it myself. It is a bug in the Picker that prevents a refresh of all data when the state changes. The work-around is to update the ID of the picker, which forces a refresh of all data. Obviously it's not a pretty solution, but at least it works until the bug is fixed.Solution below:import SwiftUI
// Data
struct Item: Identifiable {
var id = UUID()
var category:String
var item:String
}
let myCategories:[String] = ["Category 1","Category 2"]
let myItems:[Item] = [
Item(category: "Category 1", item: "Item 1.1"),
Item(category: "Category 1", item: "Item 1.2"),
Item(category: "Category 2", item: "Item 2.1"),
Item(category: "Category 2", item: "Item 2.2"),
Item(category: "Category 2", item: "Item 2.3"),
Item(category: "Category 2", item: "Item 2.4"),
]
// Factory
class MyObject: ObservableObject {
// Category picker variables
@Published var selectedCategory:String = myCategories[0]
@Published var selectedCategoryItems:[Item] = []
@Published var selectedCategoryInt:Int = 0 {
didSet {
selectCategoryActions(selectedCategoryInt)
}
}
// Item picker variables
@Published var selectedItem:Item = myItems[0]
@Published var selectedItemInt:Int = 0 {
didSet {
selectedItem = selectedCategoryItems[selectedItemInt]
}
}
@Published var pickerId:Int = 0
// Initial category selection
init() {
selectCategoryActions(selectedCategoryInt)
}
// Actions when selecting a new category
func selectCategoryActions(_ selectedCategoryInt:Int) {
selectedCategory = myCategories[selectedCategoryInt]
// Get items in category
selectedCategoryItems = myItems.filter{ $0.category.contains(selectedCategory)}
// Select initial item in category
let selectedItemIntWrapped:Int? = myItems.firstIndex { $0.category == selectedCategory }
if let selectedItemInt = selectedItemIntWrapped {
self.selectedItem = myItems[selectedItemInt]
}
self.pickerId += 1 // Hack to change ID of picker. ID is updated to force refresh
}
}
// View
struct ContentView: View {
@ObservedObject var myObject = MyObject()
var body: some View {
VStack(spacing: 10) {
Section(header: Text("Observable Object")) {
Text("Category 2 has four items, but only the first two are shown.")
Text("Selected category: \(myObject.selectedCategory)")
Text("Items in category: \(myObject.selectedCategoryItems.count)")
Text("PickerId updated to force refresh \(myObject.pickerId)")
Text("Selected item: \(myObject.selectedItem.item)")
Picker(selection: self.$myObject.selectedCategoryInt, label: Text("Select category")) {
ForEach(0 ..< myCategories.count, id: \.self) {
Text("\(myCategories[$0])")
}
}.labelsHidden()
// MARK: Something is going wrong here. I don't get right Item ID's
Picker(selection: self.$myObject.selectedItemInt, label: Text("Select object item")) {
ForEach(0 ..< self.myObject.selectedCategoryItems.count, id: \.self) {
Text("\(self.myObject.selectedCategoryItems[$0].item)")
}
}
.labelsHidden()
.id(myObject.pickerId) // Hack to get picker to reload data. ID is updated to force refresh.
}
Spacer()
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Thank you very much. This bit here really nailed for me what I was doing wrong:// @ObservedObject var settings = UserSettings()
@ObservedObject var settings : UserSettings The reason I chose Jim's answer as the correct one, is that he included information on how to achieve the same thing in different ways.
This is seriously the best answer I've gotten in a long time in a Forum. Thank you SO much. It not only explained and illustrated how to solve my issue but clarified the underlying principles of solving it, allowing me to solve other issues down the line.The other answers are great too, but this one will go into my quickly-evolving-soon-to-be-copious notes on SwiftUI and be referred back to until it's second nature.