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")
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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
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()
}
}
}
In my Metal-based app, I ray-march a 3D texture. I'd like to use RealityKit instead of my own code. I see there is a LowLevelTexture (beta) where I could specify a 3D texture. However on the Metal side, there doesn't seem to be any way to access a 3D texture (realitykit::texture::textures::custom returns a texture2d).
Any work-arounds? Could I even do something icky like cast the texture2d to a texture3d in MSL? (is that even possible?) Could I encode the 3d texture into an argument buffer and get that in somehow?
"Specifically, your App Description and screenshot references paid features but does not inform users that a purchase is required to access this content."
My App Description (Pro 3D art app) doesn't mention that the entire app is a subscription. I didn't think I needed to because Final Cut Pro and Logic Pro don't do that either. Anyone had experience with this? Is there a double-standard or did App Review just make a mistake?
Suppose I can add some language at the end of the App Description like "All Features unlocked with subscription"
I want to turn off my ray-tracing conditionally. There's is_null_acceleration_structure but when I don't bind an acceleration structure (or pass nil to setFragmentAccelerationStructure), I get the following API validation error:
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5782: failed assertion `Draw Errors Validation
Fragment Function(vol_deferred_lighting): missing instanceAccelerationStructure binding at index 6 for accelerationStructure[0].
I can turn off API validation and it works, but it seems like I should be able to use nil for the acceleration structure w/o triggering a validation error. Seems like a bug, right?
I suppose I can work around this by creating a separate pipeline with the ray-tracing disabled via a function constant instead of using is_null_acceleration_structure.
(Can we get a ray-tracing tag for questions?)
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 this error when using fragmentLinkedFunctions in Metal.
Compiler failed to build request
exception: Error Domain=CompilerError Code=2 "
Linking two modules of different data layouts: '' is '' whereas '1' is 'e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32'
SC compilation failure
More boolean const than hw allows" UserInfo={NSLocalizedDescription=
Linking two modules of different data layouts: '' is '' whereas '1' is 'e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32'
SC compilation failure
More boolean const than hw allows}
Anyone know what that all means?
If I replace the body of my intersection function with just return {false, 0.0f}, I get only the More boolean const than hw allows.
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!
In Platforms State of the Union, there was a reference to "Custom Gestures" in SwiftUI, among new features. I didn't see anything about it in What's New with SwiftUI. Did I miss it? Anyone have more info?
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've got the following code to generate an MDLMaterial from my own material data model:
public extension MaterialModel {
var mdlMaterial: MDLMaterial {
let f = MDLPhysicallyPlausibleScatteringFunction()
f.metallic.floatValue = metallic
f.baseColor.color = CGColor(red: CGFloat(color.x), green: CGFloat(color.y), blue: CGFloat(color.z), alpha: 1.0)
f.roughness.floatValue = roughness
return MDLMaterial(name: name, scatteringFunction: f)
}
}
When exporting to OBJ, I get the expected material properties:
# Apple ModelI/O MTL File: testExport.mtl
newmtl material_1
Kd 0.163277 0.0344635 0.229603
Ka 0 0 0
Ks 0
ao 0
subsurface 0
metallic 0
specularTint 0
roughness 0
anisotropicRotation 0
sheen 0.05
sheenTint 0
clearCoat 0
clearCoatGloss 0
newmtl material_2
Kd 0.814449 0.227477 0.124541
Ka 0 0 0
Ks 0
ao 0
subsurface 0
metallic 0
specularTint 0
roughness 1
anisotropicRotation 0
sheen 0.05
sheenTint 0
clearCoat 0
clearCoatGloss 0
However when exporting USD I just get:
#usda 1.0
(
defaultPrim = "_0"
endTimeCode = 0
startTimeCode = 0
timeCodesPerSecond = 60
upAxis = "Y"
)
def Xform "Obj0"
{
def Mesh "_"
{
uniform bool doubleSided = 0
float3[] extent = [(896, 896, 896), (1152, 1152, 1148.3729)]
int[] faceVertexCounts = ...
int[] faceVertexIndices = ...
point3f[] points = ...
}
def Mesh "_0"
{
uniform bool doubleSided = 0
float3[] extent = [(898.3113, 896.921, 1014.4961), (1082.166, 1146.7178, 1152)]
int[] faceVertexCounts = ...
int[] faceVertexIndices = ...
point3f[] points = ...
matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}
There aren't any material properties.
FWIW, this specifies a set of common material parameters for USD: https://openusd.org/release/spec_usdpreviewsurface.html
(Note: there is no tag for ModelIO, so using SceneKit, etc.)
Anyone have a sense of what could cause this? Running on iOS 17.0.2. This seems to be a regression in iOS 17.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100ad4437fff8)
* frame #0: 0x00000001ca2264ec AttributeGraph`AG::swift::existential_type_metadata::project_value(void const*) const + 40
frame #1: 0x00000001ca2349a8 AttributeGraph`AG::LayoutDescriptor::compare_existential_values(AG::swift::existential_type_metadata const*, unsigned char const*, unsigned char const*, unsigned int) + 108
frame #2: 0x00000001ca21b938 AttributeGraph`AG::LayoutDescriptor::Compare::operator()(unsigned char const*, unsigned char const*, unsigned char const*, unsigned long, unsigned int) + 560
frame #3: 0x00000001ca21b9b8 AttributeGraph`AG::LayoutDescriptor::Compare::operator()(unsigned char const*, unsigned char const*, unsigned char const*, unsigned long, unsigned int) + 688
frame #4: 0x00000001ca21b674 AttributeGraph`AG::LayoutDescriptor::compare(unsigned char const*, unsigned char const*, unsigned char const*, unsigned long, unsigned int) + 96
frame #5: 0x00000001ca21afb0 AttributeGraph`AGGraphSetOutputValue + 268
frame #6: 0x00000001a7bdd924 SwiftUI`___lldb_unnamed_symbol227590 + 72
frame #7: 0x00000001a6ce9194 SwiftUI`___lldb_unnamed_symbol111702 + 20
frame #8: 0x000000019bca3994 libswiftCore.dylib`Swift.withUnsafePointer<τ_0_0, τ_0_1>(to: inout τ_0_0, _: (Swift.UnsafePointer<τ_0_0>) throws -> τ_0_1) throws -> τ_0_1 + 28
frame #9: 0x00000001a6c6d70c SwiftUI`___lldb_unnamed_symbol110270 + 1592
frame #10: 0x00000001a7bdeb3c SwiftUI`___lldb_unnamed_symbol227617 + 408
frame #11: 0x00000001a7bde698 SwiftUI`___lldb_unnamed_symbol227614 + 876
frame #12: 0x00000001a7619cfc SwiftUI`___lldb_unnamed_symbol184045 + 32
frame #13: 0x00000001ca21e854 AttributeGraph`AG::Graph::UpdateStack::update() + 512
frame #14: 0x00000001ca215504 AttributeGraph`AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 424
frame #15: 0x00000001ca21ff58 AttributeGraph`AG::Subgraph::update(unsigned int) + 848
frame #16: 0x00000001a7a621d4 SwiftUI`___lldb_unnamed_symbol216794 + 384
frame #17: 0x00000001a7a63610 SwiftUI`___lldb_unnamed_symbol216852 + 24
frame #18: 0x00000001a710a638 SwiftUI`___lldb_unnamed_symbol143862 + 28
frame #19: 0x00000001a7b55a0c SwiftUI`___lldb_unnamed_symbol223201 + 108
frame #20: 0x00000001a7b481f4 SwiftUI`___lldb_unnamed_symbol223031 + 96
frame #21: 0x00000001a710187c SwiftUI`___lldb_unnamed_symbol143639 + 84
frame #22: 0x00000001a7a635d8 SwiftUI`___lldb_unnamed_symbol216851 + 200
frame #23: 0x00000001a7a634c4 SwiftUI`___lldb_unnamed_symbol216850 + 72
frame #24: 0x00000001a74514c0 SwiftUI`___lldb_unnamed_symbol170645 + 28
frame #25: 0x00000001a6d196d4 SwiftUI`___lldb_unnamed_symbol114472 + 120
frame #26: 0x00000001a6d19780 SwiftUI`___lldb_unnamed_symbol114473 + 72
frame #27: 0x00000001a490ad94 UIKitCore`_UIUpdateSequenceRun + 84
frame #28: 0x00000001a490a484 UIKitCore`schedulerStepScheduledMainSection + 144
frame #29: 0x00000001a490a540 UIKitCore`runloopSourceCallback + 92
frame #30: 0x00000001a2684acc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
frame #31: 0x00000001a2683d48 CoreFoundation`__CFRunLoopDoSource0 + 176
frame #32: 0x00000001a26824fc CoreFoundation`__CFRunLoopDoSources0 + 244
frame #33: 0x00000001a2681238 CoreFoundation`__CFRunLoopRun + 828
frame #34: 0x00000001a2680e18 CoreFoundation`CFRunLoopRunSpecific + 608
frame #35: 0x00000001e51415ec GraphicsServices`GSEventRunModal + 164
frame #36: 0x00000001a4a8f350 UIKitCore`-[UIApplication _run] + 888
frame #37: 0x00000001a4a8e98c UIKitCore`UIApplicationMain + 340
frame #38: 0x00000001a7457354 SwiftUI`___lldb_unnamed_symbol171027 + 176
frame #39: 0x00000001a7457198 SwiftUI`___lldb_unnamed_symbol171025 + 152
frame #40: 0x00000001a70d4434 SwiftUI`___lldb_unnamed_symbol142421 + 128
I'm getting
Thread 5: EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=6 MB)
My thumbnails do render (and they require more than 6mb to do so), so I wonder about the behavior here. Does the OS try to render thumbnails with a very low memory limit and then retry if that fails?
I'm trying to get boost to compile for the iOS simulator on my M2 Mac.
I've got this script:
set -euxo pipefail
# See https://formulae.brew.sh/formula/boost
# See https://stackoverflow.com/questions/1577838/how-to-build-boost-libraries-for-iphone
wget https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2
tar zxf boost_1_83_0.tar.bz2
mv boost_1_83_0 boost
root=`pwd`
cd boost
B2_ARGS="-a -j12 --with-iostreams --with-regex"
# Build for simulator
./bootstrap.sh --prefix=$root/install-ios-sim
IOSSIM_SDK_PATH=$(xcrun --sdk iphonesimulator --show-sdk-path)
cat << EOF >> project-config.jam
# IOS Arm Simulator
using clang : iphonesimulatorarm64
: xcrun clang++ -arch arm64 -stdlib=libc++ -std=c++20 -miphoneos-version-min=16.0 -fvisibility-inlines-hidden -target arm64-apple-ios16.0-simulator -isysroot $IOSSIM_SDK_PATH
;
EOF
./b2 $B2_ARGS --prefix=$root/install-ios-sim toolset=clang-iphonesimulatorarm64 link=static install
xcodebuild -create-xcframework thinks ./install-ios-sim/libboost_iostreams.a is not for the simulator.
Specifically, if you run the following after the build script, it will show the binary is ios-arm64.
xcodebuild -create-xcframework \
-library install-ios-sim/lib/libboost_iostreams.a \
-headers install-ios-sim/include \
-output boost.xcframework
I know how to use lipo, etc to determine the architecture of a library, but I don't know how create-xcframework differentiates a simulator binary from an iOS binary.
Note: I've also tried using the boost build script by Pete Goodliffe which generates an xcframework. However, I need a normal install of boost because I'm compiling other libraries against it. I couldn't get the script to do that. I also don't understand how the script successfully generates a simulator binary.