Post

Replies

Boosts

Views

Activity

Reply to Application is rejected because of Missing IAPs?
The thing I missed was that in addition to all the information on the In App Purchase section, you have to select the IAPs to attach on the product page (the page where you enter the description and select a binary). The IAPs have to be selected like you select the binary. Easy to miss and Apple isn’t good about explaining that In their rejection.
Topic: App & System Services SubTopic: StoreKit Tags:
Jan ’24
Reply to [WindowHosting] UIScene property of UINSSceneViewController was accessed before it was set. What does this mean?
I'm getting the same error "UIScene property of UINSSceneViewController was accessed before it was set." 3 times in the console when I run the following targeting My Mac (Mac Catalyst). I do not get the error in the iPhone 15 Pro simulator or when running targeting My Mac (Designed for iPad) so I think it might be a bug. struct ContentView: View { @State var testIsPresented = false var body: some View { NavigationView { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) } .toolbar { Menu("Test") { Button("Show Sheet") { testIsPresented = true } } .sheet(isPresented: $testIsPresented) { Button("Dismiss") { testIsPresented = false } } } } } }
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’23
Reply to App crashes after deleting list item from CoreData - no debug output
Found a fix! (Credit: https://blog.apptekstudios.com/2020/05/quick-tip-avoid-crash-when-using-foreach-bindings-in-swiftui/) Add this extension and then when referencing the index, use [safe:index] and everything works as expected! // Fix for race condition issue extension Binding where Value: MutableCollection {     subscript(safe index: Value.Index) -> Binding<Value.Element> {         // Get the value of the element when we first create the binding         // Thus we have a 'placeholder-value' if `get` is called when the index no longer exists         let safety = wrappedValue[index]         return Binding<Value.Element>(             get: {                 guard self.wrappedValue.indices.contains(index)                 else { return safety } //If this index no longer exists, return a dummy value                 return self.wrappedValue[index]             },             set: { newValue in                 guard self.wrappedValue.indices.contains(index)                 else { return } //If this index no longer exists, do nothing                 self.wrappedValue[index] = newValue             })     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22
Reply to App crashes after deleting list item from CoreData - no debug output
I’m having the same problem in Swift Playgrounds for iPad (and I’m not even using CoreData). I’ve put in a bunch of debugging to make sure no indexes are out of bounds, but I’m guessing something is being cached related to the ForEach loop where it’s either referencing the deleted item or using a cached version of the array and not noticing the array has been modified. Note that the debug print statement does not seem to execute before using the index and the list is being edited elsewhere so I think there could be some sort of observer/synchronization issue going on… struct HeartsScoreBox: View {     @ObservedObject var round: HeartsRound     @State var playerIndex: Int     var body: some View {         VStack {             let _ = print("HSB# scores: \(round.playerScores.count), index: \(playerIndex)")             let score = round.playerScores[playerIndex]             Text(String(describing:score))         }     } } And the crash report: Application Specific Information: dyld: dyld4 config: DYLD_INSERT_LIBRARIES=/System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection libswiftCore.dylib: Swift/ContiguousArrayBuffer.swift:575: Fatal error: Index out of range Thread: 0 libswiftCore.dylib closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) 1 libswiftCore.dylib closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) 2 libswiftCore.dylib closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) 3 libswiftCore.dylib closure #1 in _assertionFailure(_:_:file:line:flags:) 4 libswiftCore.dylib _assertionFailure(_:_:file:line:flags:) 5 libswiftCore.dylib _ArrayBuffer._checkInoutAndNativeTypeCheckedBounds(_:wasNativeTypeChecked:) 6 libswiftCore.dylib Array.subscript.getter 7 Previews_HeartsGameView_Thunk_1.dylib closure #1 in HeartsScoreBox.__preview__body.getter /private/var/mobile/Library/Mobile Documents/iCloud~com~apple~Playgrounds/Documents/Score!.swiftpm/Games/Hearts/HeartsGameView.swift:11 8 SwiftUI VStack.init(alignment:spacing:content:) 9 Previews_HeartsGameView_Thunk_1.dylib HeartsScoreBox.__preview__body.getter /private/var/mobile/Library/Mobile Documents/iCloud~com~apple~Playgrounds/Documents/Score!.swiftpm/Games/Hearts/HeartsGameView.swift:9 10 Score! protocol witness for View.body.getter in conformance HeartsScoreBox /<compiler-generated>:0 11 SwiftUI partial apply for closure #1 in ViewBodyAccessor.updateBody(of:changed:) 12 SwiftUI closure #1 in BodyAccessor.setBody(_:) 13 SwiftUI ViewBodyAccessor.updateBody(of:changed:) 14 SwiftUI DynamicBody.updateValue() 15 SwiftUI partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) 16 AttributeGraph AG::Graph::UpdateStack::update() 17 AttributeGraph AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) 18 AttributeGraph AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, unsigned char&) 19 AttributeGraph AGGraphGetValue 20 SwiftUI GraphHost.updatePreferences() 21 SwiftUI ViewGraph.updateOutputs() 22 SwiftUI closure #1 in ViewRendererHost.render(interval:updateDisplayList:) 23 SwiftUI ViewRendererHost.render(interval:updateDisplayList:) 24 SwiftUI _UIHostingView.layoutSubviews() 25 SwiftUI @objc _UIHostingView.layoutSubviews() 26 UIKitCore -[UIView(CALayerDelegate) layoutSublayersOfLayer:] 27 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) 28 UIKitCore -[UIView(Hierarchy) layoutBelowIfNeeded] 29 SwiftUI closure #3 in performUpdates #1 <A, B>() in UITableViewListCoordinator.updateUITableView(_:to:transaction:) 30 SwiftUI thunk for @callee_guaranteed () -> () 31 SwiftUI thunk for @escaping @callee_guaranteed () -> () 32 UIKitCore +[UIView(Animation) performWithoutAnimation:] 33 SwiftUI performUpdates #1 <A, B>() in UITableViewListCoordinator.updateUITableView(_:to:transaction:) 34 SwiftUI thunk for @callee_guaranteed () -> () 35 SwiftUI thunk for @escaping @callee_guaranteed () -> () 36 UIKitCore +[UIView(Animation) performWithoutAnimation:] 37 SwiftUI closure #2 in UITableViewListCoordinator.updateUITableView(_:to:transaction:) 38 SwiftUI thunk for @escaping @callee_guaranteed () -> () 39 SwiftUI static Update.end() 40 SwiftUI static NSRunLoop.flushObservers() 41 SwiftUI closure #1 in closure #1 in static NSRunLoop.addObserver(_:) 42 SwiftUI specialized thunk for @callee_guaranteed () -> (@error @owned Error) 43 libswiftObjectiveC.dylib autoreleasepool<A>(invoking:) 44 SwiftUI closure #1 in static NSRunLoop.addObserver(_:) 45 SwiftUI @objc closure #1 in static NSRunLoop.addObserver(_:) 46 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ …
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22
Reply to How do I get promo codes?
Finally found it. It isn’t available through the app. On the website on iOS it’s under the menu containing the blue “App Store” text (select “Services”). On desktop/iPad, it’s the “Services” tab. From there, it’s the last item on the left “Promo Codes”. Hope this helps someone else or my future self!
Oct ’21
Reply to APNS api address
I got a message about push servers updating. Is this only true/applicable for apps or does this apply to web service code that may use the push notification service (as I'm using)? I too have been using gateway.sandbox.push.apple.com:2195 since 2012 without issue. Will that stop working after the change?
Oct ’20