I had to switch from the SwiftUI app lifecycle to the UIKit lifecycle due to this issue: https://developer.apple.com/forums/thread/742580
When I switch to UIKit I get a black screen on startup. It's the inverse of this issue: https://openradar.appspot.com/FB9692750
For development, I can work around this by deleting and reinstalling the app, but I can't ship an app that results in a black screen for users when they update.
Anyone know of a work-around?
I've filed FB13462315
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I've got a scene which renders as I expect:
but in the acceleration structure inspector, the kraken primitive doesn't render:
In the list on the left, the structure is there. As expected, there is just one bounding-box primitive as a lot happens in the intersection function (doing it this way since I've already built my own octree and it takes too long to rebuild BVHs for dynamic geometry)
This is just based on the SimplePathTracer example.
The signatures of the sphereIntersectionFunction and octreeIntersectionFunction aren't that different:
[[intersection(bounding_box, triangle_data, instancing)]]
BoundingBoxIntersection sphereIntersectionFunction(// Ray parameters passed to the ray intersector below
float3 origin [[origin]],
float3 direction [[direction]],
float minDistance [[min_distance]],
float maxDistance [[max_distance]],
// Information about the primitive.
unsigned int primitiveIndex [[primitive_id]],
unsigned int geometryIndex [[geometry_intersection_function_table_offset]],
// Custom resources bound to the intersection function table.
device void *resources [[buffer(0), function_constant(useResourcesBuffer)]]
#if SUPPORTS_METAL_3
,const device Sphere* perPrimitiveData [[primitive_data]]
#endif
,ray_data IntersectionPayload& payload [[payload]])
{
vs.
[[intersection(bounding_box, triangle_data, instancing)]]
BoundingBoxIntersection octreeIntersectionFunction(// Ray parameters passed to the ray intersector below
float3 origin [[origin]],
float3 direction [[direction]],
float minDistance [[min_distance]],
float maxDistance [[max_distance]],
// Information about the primitive.
unsigned int primitiveIndex [[primitive_id]],
unsigned int geometryIndex [[geometry_intersection_function_table_offset]],
// Custom resources bound to the intersection function table.
device void *resources [[buffer(0)]],
const device BlockInfo* perPrimitiveData [[primitive_data]],
ray_data IntersectionPayload& payload [[payload]])
Note: running 15.0 beta 5 (15A5209g) since even the unmodified SimplePathTracer example project will hang the acceleration structure viewer on Xcode 14.
Update:
Replacing the octreeIntersectionFunction's code with just a hard-coded sphere does render. Perhaps the viewer imposes a time (or instruction count) limit on intersection functions so as to not hang the GPU?
Why Auto Layout instead of the horizontal and vertical boxes used by other systems like Qt? Or a layout system like CSS?What is missing in the other ways of doing this stuff?Over a couple years, Auto Layout has given me mostly headaches, and I now generally try to avoid it, so I want to know if there's a good reason for my suffering.thanks!
I'm getting the following error on Intel Iris integrated graphics. Code works well on newer Mac GPUs as well as Apple GPUs.
Execution of the command buffer was aborted due to an error during execution. Invalid Resource (00000009:kIOAccelCommandBufferCallbackErrorInvalidResource)
The error is for a compute command, not a draw command.
The constant isn't in the documentation. All buffers and textures seem to be created successfully. I've also checked that the GPU supports the required threadgroup size for the compute pipeline.
thanks!
I have on the order of 50k small meshes (~64 vertices), all different connectivity, some subset of which change each frame (generated by a compute kernel). Can I render those in a performant way with Metal?
I'm assuming 50k separate draw calls would be too slow. I have a few ideas:
encode those draw calls on the GPU
or lay out the meshes linearly in blocks, with some maximum size, and use a single draw call, but wasting vertex shader threads on the blocks that aren't full
or use another kernel to combine the little meshes into a big mesh
thanks!
Adding an inspector and toolbar to Xcode's app template, I have:
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
.toolbar {
Text("test")
}
.inspector(isPresented: .constant(true)) {
Text("this is a test")
}
}
}
In the preview canvas, this renders as I would expect:
However when running the app:
Am I missing something?
(Relevant wwdc video is wwdc2023-10161. I couldn't add that as a tag)
I've had to ditch the SwiftUI app lifecycle due to this issue: https://developer.apple.com/forums/thread/742580
After creating a new UIKit document app as a test, it doesn't have a toolbar when opening the document. How can I add one along the lines of https://developer.apple.com/wwdc22/10069 ?
The UIDocumentViewController isn't already embedded in a UINavigationController it seems.
To reproduce: New Project -> iOS -> Document App. Select Interface: Storyboard. Add an empty "untitled.txt" resource to the project. Change the first line in documentBrowser(_:,didRequestDocumentCreationWithHandler:) to
let newDocumentURL: URL? = Bundle.main.url(forResource: "untitled", withExtension: "txt")
In my app, I only get one interruption notification when a phone call comes in, and nothing after that. The app uses AVAudioEngine. Is this a bug?
A very simple repro is to just register for the notification, but not do anything else with audio:
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
.onReceive(NotificationCenter.default.publisher(for: AVAudioSession.interruptionNotification)) { event in
handleAudioInterruption(event: event)
}
}
private func handleAudioInterruption(event: Notification) {
print("handleAudioInterruption")
guard let info = event.userInfo,
let typeValue = info[AVAudioSessionInterruptionTypeKey] as? UInt,
let type = AVAudioSession.InterruptionType(rawValue: typeValue) else {
print("missing the stuff")
return
}
if type == .began {
print("interruption began")
} else if type == .ended {
print("interruption ended")
guard let optionsValue = info[AVAudioSessionInterruptionOptionKey] as? UInt else { return }
if AVAudioSession.InterruptionOptions(rawValue: optionsValue).contains(.shouldResume) {
print("should resume")
}
}
}
}
And do this in the app's init:
@main
struct InterruptionsApp: App {
init() {
try! AVAudioSession.sharedInstance().setCategory(.playback,
options: [])
try! AVAudioSession.sharedInstance().setActive(true)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
I'm modifying <1mb of a 256mb managed buffer (calling didModifyRange), but according to Metal System Trace, the GPU copies the whole buffer (SDMA0 channel, "Page On 268435456 bytes"), taking 13ms.
I'm making lots of small modifications (~4k) per frame. I also tried coalescing into a single call to didModifyRange (~66mb) and still the entire buffer is copied. I also tried calling didModifyRange for the first byte, and then the copied data is small.
So I'm wondering why didModifyRange doesn't seem to be efficient for many small updates to a big buffer?
How should an App Extension (in this case an Audio Unit Extension) determine if an IAP has been purchased in the containing app? (and related: can an IAP be purchased from within the extension?)
On macOS, I suppose I could share the receipt file with the extension? and on iOS, suppose I could write some data to shared UserDefaults in an app group.
Is there any official guidance on this?
thanks!
I have an app (currently for sale on the Mac App Store) which is a programming environment for audio processing (DSP node graph). I would like it to be able to export apps that are ready to be uploaded to the App Store or Mac App Store (including Audio Unit extensions).
Can I code sign from within my Mac App Store app? (Seems I can use Process to invoke codesign. Otherwise perhaps I could add the source for codesign to my app.. it seems to be open source)
Is this whole process too hard for a solo developer to take on?
What resources should I look at?
thanks!
I'm getting this segfault stack trace from TestFlight. Any idea about how I should approach it?
Thread 0 Crashed:
0 SwiftUI 0x000000018dd18e14 specialized static Array<A>.== infix(_:_:) + 0 (<compiler-generated>:0)
1 SwiftUI 0x000000018e2ab404 static StrokeStyle.== infix(_:_:) + 100 (<compiler-generated>:0)
2 SwiftUI 0x000000018e2ab468 protocol witness for static Equatable.== infix(_:_:) in conformance StrokeStyle + 60 (<compiler-generated>:0)
3 AttributeGraph 0x00000001b0e4feec AGDispatchEquatable + 24 (Misc.swift:160)
4 AttributeGraph 0x00000001b0e4fd68 AG::LayoutDescriptor::Compare::operator()(unsigned char const*, unsigned char const*, unsigned char const*, unsigned long, unsigned int) + 1632 (ag-value.cc:579)
5 AttributeGraph 0x00000001b0e4f674 AG::LayoutDescriptor::compare(unsigned char const*, unsigned char const*, unsigned char const*, unsigned long, unsigned int) + 96 (ag-value.cc:723)
6 AttributeGraph 0x00000001b0e4efb0 AGGraphSetOutputValue + 268 (AGGraph.mm:784)
7 SwiftUI 0x000000018e8c1eb4 closure #1 in StatefulRule.value.setter + 72 (<compiler-generated>:0)
8 SwiftUI 0x000000018defc57c partial apply for closure #1 in StatefulRule.value.setter + 20 (<compiler-generated>:0)
9 libswiftCore.dylib 0x0000000182a779e4 withUnsafePointer<A, B>(to:_:) + 28 (LifetimeManager.swift:128)
10 SwiftUI 0x000000018def9e84 closure #1 in closure #1 in UnwrapConditional.updateValue() + 360 (ConditionalMetadata.swift:286)
11 SwiftUI 0x000000018defc55c partial apply for closure #1 in closure #1 in UnwrapConditional.updateValue() + 36 (<compiler-generated>:0)
12 SwiftUI 0x000000018def8374 ConditionalTypeDescriptor.project(at:baseIndex:_:) + 192 (ConditionalMetadata.swift:203)
13 SwiftUI 0x000000018def8458 ConditionalTypeDescriptor.project(at:baseIndex:_:) + 420 (ConditionalMetadata.swift:212)
14 SwiftUI 0x000000018def9cf0 closure #1 in UnwrapConditional.updateValue() + 136 (ConditionalMetadata.swift:283)
15 SwiftUI 0x000000018defc530 partial apply for closure #1 in UnwrapConditional.updateValue() + 28 (<compiler-generated>:0)
16 libswiftCore.dylib 0x0000000182a779e4 withUnsafePointer<A, B>(to:_:) + 28 (LifetimeManager.swift:128)
17 SwiftUI 0x000000018def9c1c UnwrapConditional.updateValue() + 260 (ConditionalMetadata.swift:282)
18 SwiftUI 0x000000018e3b3de8 partial apply for implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32 (<compiler-generated>:0)
19 AttributeGraph 0x00000001b0e52854 AG::Graph::UpdateStack::update() + 512 (ag-graph-update.cc:578)
20 AttributeGraph 0x00000001b0e49504 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 424 (ag-graph-update.cc:719)
(UIApplication.m:3679)
....
137 UIKitCore 0x000000018b841cf0 UIApplicationMain + 340 (UIApplication.m:5266)
138 SwiftUI 0x000000018e1f2ff8 closure #1 in KitRendererCommon(_:) + 176 (UIKitApp.swift:37)
139 SwiftUI 0x000000018e1f2e3c runApp<A>(_:) + 152 (UIKitApp.swift:14)
140 SwiftUI 0x000000018de6fda0 static App.main() + 128 (App.swift:114)
141 Sculptura 0x0000000100b61f50 static SculpturaApp.$main() + 24 (SculpturaApp.swift:17)
142 Sculptura 0x0000000100b61f50 main + 36 (SculpturaApp.swift:0)
143 dyld 0x00000001abaafd44 start + 2104 (dyldMain.cpp:1269)
High up in the trace there's some ZStack layout stuff. Maybe just trying to simplify my view hierarchy?
(I wonder if this would be more stable if AttributeGraph wasn't written in C++)
I received a rejection for "Your app spawns processes that continue running after the user has quit the app."
The process in question is the app's Thumbnail extension.
When I remove all of my own code from the thumbnail extension, it still continues to run after I exit my app. This is the entirety of the extension's code, which now renders blank thumbnails:
import QuickLookThumbnailing
class ThumbnailProvider: QLThumbnailProvider {
override init() { }
override func provideThumbnail(for request: QLFileThumbnailRequest,
_ handler: @escaping (QLThumbnailReply?, Error?) -> Void) {
let reply = QLThumbnailReply(contextSize: request.maximumSize) { (context: CGContext) -> Bool in
return true
}
handler(reply, nil)
}
}
Presumably Thumbnail extensions continue to run so that Finder (among others) can generate thumbnails as necessary. AFAIK, I have no direct control over the extension's lifecycle.
Is this just App Review's mistake? The "Next Steps" are clueless:
"You can resolve this by leaving this option unchecked by default, providing the user the option to turn it on."
The app uses its own thumbnail extension to render thumbnails for document templates, which may be an uncommon thing.
Is this an uncaught C++ exception that could have originated from my code? or something else? (this report is from a tester)
(also, why can't crash reporter tell you info about what exception wasn't caught?)
(Per instructions here, to view the crash report, you'll need to rename the attached .txt to .ips to view the crash report)
thanks!
AudulusAU-2024-02-14-020421.txt
I'm recreating the sleep timer from the Podcasts app. How can I display an icon for the picker instead of the current selection?
This doesn't work:
Picker("Sleep Timer", systemImage: "moon.zzz.fill", selection: $sleepTimerDuration) {
Text("Off").tag(0)
Text("5 Minutes").tag(5)
Text("10 Minutes").tag(10)
Text("15 Minutes").tag(15)
Text("30 Minutes").tag(30)
Text("45 Minutes").tag(45)
Text("1 Hour").tag(60)
}
Do I need to drop down to UIKit for this?
Topic:
UI Frameworks
SubTopic:
SwiftUI