For me the scenario is this:
Query all records and you can see the values for all fields
Query using a filter for a known value and no results returned...
I have all the indexes added to the fields I want to query against, but it still finds nothing...
Some of my filter fields work, but a new one I just added to filter on another data point fails to get any data...
I should add I am trying this from the console right now since I noticed the problem while coding, and the problem is the same in code and the console...
Post
Replies
Boosts
Views
Activity
Suddenly I am now having the same issue. Using the product id's is allowing the store view to show but the subscriptionstatustask doesn't work...How are we to make that work with product ids?
Hello @ex-coder,
I actually just hit the same problem you were experiencing here. And the fix was actually really simple! Just have to add an Id to the List view. Here is an example:
List { ForEach(localTemplates, id:\.templateId) { template in LocalTemplateListCellView( template: template, rating: Int(template.rating), share: $share, use: $use) } .onDelete { indexSet in confirmDelete = true deleteIndexSet = indexSet } .alert("Delete? This can not be undone...", isPresented: $confirmDelete) { Button("Yes", role: .destructive) { guard let indexSet = deleteIndexSet else { return } delete(at: indexSet) confirmDelete = false } Button("No", role: .cancel) { confirmDelete = false } } } .id(localTemplates.count)
Notice the ".id(localTemplates.count)". This generates a new ID for the list when it changes, and avoids the issue of anything being nil when the view refreshes after the array changes.
Hopefully this helps someone else in the future. :)
I'm also getting the insufficient memory errors and my canvases are not even visible all at the same time. I think in my case it has something to do with an environmentObject variable that holds a list of pkdrawings for each canvas. If i change that environmentObject variable to a state variable things are better, but then i lose drawings as others are added to the object. Not sure how to overcome this....
Execution of the command buffer was aborted due to an error during execution. Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
OH SNAP!!
I figured it out! I was putting things in the wrong order in my view definition!
Here is the final working view, that is both draggable and resizable!!
import SwiftUI
struct MovableResizableView<Content>: View where Content: View {
@GestureState private var dragState = DragState.inactive
@State private var currentScale: CGFloat = 0
@State private var finalScale: CGFloat = 1
@State var width: CGFloat = 150
@State var height: CGFloat = 150
@State private var newPosition: CGSize = .zero
@State private var isDragging = false
var content: () -> Content
var body: some View {
content()
.opacity(dragState.isPressing ? 0.5 : 1.0)
.scaleEffect(finalScale + currentScale)
.offset(x: dragState.translation.width + newPosition.width, y: dragState.translation.height + self.newPosition.height)
.animation(Animation.easeInOut(duration: 0.1), value: 0)
.gesture(LongPressGesture(minimumDuration: 1.0)
.sequenced(before: DragGesture())
.updating($dragState, body: { (value, state, transaction) in
switch value {
case .first(true):
state = .pressing
case .second(true, let drag):
state = .dragging(translation: drag?.translation ?? .zero)
default:
break
}
})
.onEnded({ (value) in
guard case .second(true, let drag?) = value else {
return
}
self.newPosition.height += drag.translation.height
self.newPosition.width += drag.translation.width
}))
.gesture(MagnificationGesture()
.onChanged{ newScale in
currentScale = newScale
}
.onEnded { scale in
finalScale = scale
currentScale = 0
})
}
}
struct MovableResizableView_Previews: PreviewProvider {
static var previews: some View {
MovableResizableView() {
Image(systemName: "star.circle.fill")
.resizable()
.frame(width: 100, height: 100)
.foregroundColor(.green)
}
}
}
Since I can't edit my question, and the comments only allow in-line code I am going to post my other attempt at making this work using Apple's documented way (doesn't work either):
import SwiftUI
struct MovableResizableView<Content>: View where Content: View {
//@ObservedObject var imageModel: YearImageViewModel
@GestureState private var dragState = DragState.inactive
@GestureState private var scale: CGFloat = 1.0
@State var image = UIImage()
@State var width: CGFloat = 150
@State var height: CGFloat = 150
@State private var currentPosition: CGSize = .zero
@State private var newPosition: CGSize = .zero
@State private var isDragging = false
@State private var deleteBtn = false
@State private var deleted = false
var content: () -> Content
var body: some View {
content()
.opacity(dragState.isPressing ? 0.5 : 1.0)
.offset(x: dragState.translation.width + newPosition.width, y: dragState.translation.height + self.newPosition.height)
.animation(Animation.easeInOut(duration: 0.1), value: 0)
.gesture(LongPressGesture(minimumDuration: 1.0)
.sequenced(before: DragGesture())
.updating($dragState, body: { (value, state, transaction) in
switch value {
case .first(true):
state = .pressing
case .second(true, let drag):
state = .dragging(translation: drag?.translation ?? .zero)
default:
break
}
})
.onEnded({ (value) in
guard case .second(true, let drag?) = value else {
return
}
self.newPosition.height += drag.translation.height
self.newPosition.width += drag.translation.width
}))
.gesture(MagnificationGesture()
.updating($scale, body: { (value, scale, trans) in
scale = value.magnitude
}))
.scaleEffect(scale)
}
}
struct MovableResizableView_Previews: PreviewProvider {
static var previews: some View {
MovableResizableView() {
Image(systemName: "star.circle.fill")
.resizable()
.frame(width: 100, height: 100)
.foregroundColor(.green)
}
}
}
This makes it hard to maintain functionality that users have become accustom to when using iOS apps. Something intuitive is now broken. When a user wants to drag something and then resize it in a SwiftUI app it is no longer possible. What are the suggested workarounds for this? I'm trying to update my app to iOS 15 but this is prohibiting me from doing that. See my post: SwiftUI - Using the Drag and Magnification Gestures Sequenced
Me too...
Something has to be wrong with the apple build servers, or App Store processing servers, since the only thing I changed in my app were some aesthetics.
I was having the same issue. I thought that removing and reading the simulators would help, it didn't
Open Xcode
Expand the simulator list
Click "Add additional Simulators"
Delete all the simulators from the list
Close and reopen Xcode
Expand the simulator list
Click "Add additional Simulators"
Click the "+" to add each Simulator back
And on top of spotlight crashing, the simulator is EXTREMELY SLOOOWWWWW
This is making it really hard to work on my apps :(
Inaddition to this still happening in 13.4, it is also happening in SwiftUI. I have a view with this code, and the error happens when the user swpies to delete a row...so far I haven't found any workaround.... 😐import SwiftUI
struct ContentView: View {
@State var showNewJournal = false
@Environment(\.managedObjectContext) var managedObjectContext
@FetchRequest(entity: Journal.entity(), sortDescriptors: []) var journals: FetchedResults<Journal>
@State var image: Data = .init(count: 0)
@State var journal: Journal = Journal()
let dl = DataLoader()
var body: some View {
NavigationView {
List {
ForEach(journals, id: \.journalId){ journal in
HStack{
NavigationLink(destination: MonthSelector(journalId: journal.journalId)) {
VStack(alignment: .leading){
Image(uiImage: UIImage(data: (journal.coverImage ?? UIImage(named: "defaultPhoto.jpg")?.pngData())!)!
.withHorizontallyFlippedOrientation())
.resizable()
.frame(width: 100, height: 100)
.aspectRatio(contentMode: .fill)
.clipShape(Circle())
.flipsForRightToLeftLayoutDirection(true)
Text("Journal Name: \(journal.journalName)")
.font(.headline)
Text("Style: \(journal.style)")
.font(.caption)
}
}
}
}
.onDelete(perform: delete)
}
.navigationBarTitle("My Journals")
.navigationBarItems(trailing: Button(action: {
self.showNewJournal = true
}, label: {
Image(systemName: "plus.circle")
.resizable()
.frame(width: 32, height: 32, alignment: .topTrailing)
}))
.sheet(isPresented: $showNewJournal) {
NewJournal().environment(\.managedObjectContext, self.managedObjectContext)
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
func delete(at offsets: IndexSet) {
var jid = UUID()
for index in offsets {
let journal = journals[index]
jid = journal.journalId
managedObjectContext.delete(journal)
}
do {
try managedObjectContext.save()
} catch {
print("Successfully deleted journal...")
}
dl.deleteData(journalId: jid)
}
}would be nice if anyone with a bit more experience could let me know what can be done as a workaround for this.Oh and it is making the app crash 😟