Post

Replies

Boosts

Views

Activity

Reply to Xcode won't execute code?
in this example: struct ContentView: View { var body: some View { Button("Tap Me") { // Action to perform when the button is tapped print("Button was tapped!") startAccelerometer() } } } you see the error "Cannot find 'startAccelerometer' in scope" because startAccelerometer is outside the scope of the structure ContentView (which begins at its { and ends at its }. The compiler doesn't know you mean the function called startAccelerometer inside your MyViewController class. That's a good thing, because names are often re-used in different places in code. In your more recent example, your ContentView doesn't refer to startAccelerometer, and there is no code to call it (what happened to your button? Your screen is blank and white because that's what an empty content view looks like. Your startAccelerometer function, if called, would call itself again and again until your program ran out of stack space and was terminated. You usually don't need a UIViewController in a SwiftUI app. Interfacing between SwiftUI and UIKit is an advanced topic. I suggest you take a step back and review a few simple SwiftUI projects so you can get the hang of drawing into a window and responding to clicks and drags inside a view. You should also try to learn about basic programming concepts like scope. Or, if you are just desperate to see what is going on with the accelerometer, here is a quick and dirty program which will print the results into the debugger console in Xcode on your Mac while the program runs on your phone. It is not a good example of app design (most code samples are not) import SwiftUI import CoreMotion struct ContentView: View { @State private var motionManager: CMMotionManager = CMMotionManager() var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .onAppear() { if motionManager.isAccelerometerAvailable { motionManager.accelerometerUpdateInterval = 0.1 // 10 updates per second motionManager.startAccelerometerUpdates(to: .main) { (data, error) in guard let accelerometerData = data else { return } let x = accelerometerData.acceleration.x let y = accelerometerData.acceleration.y let z = accelerometerData.acceleration.z // Process the x, y, and z acceleration values here print("X: \(x), Y: \(y), Z: \(z)") } } } } }
Aug ’25
Reply to Unable to get external display working
does your iPad support anything other than mirroring? See https://support.apple.com/guide/ipad/connect-to-a-display-with-a-cable-ipadf1276cde/18.0/ipados/18.0 Also, you need a touchpad or mouse, because otherwise you can't manipulate windows on the external screen. And you might need an external keyboard too.
Topic: UI Frameworks SubTopic: SwiftUI
Aug ’25
Reply to Xcode Beta (Version 26.0 beta 5 (17A5295f)) Constantly Crashing!
it works for me (M1 MBA and M1 MBP with M1 Pro). If I were you, I'd file a bug, then delete Xcode 26b5 and everything associated with it, then re-install it. If that doesn't work, and you're on a beta of macOS, wipe the Mac and reinstall everything. If it is still a problem, follow up on the bug with new crash logs. If it is fixed, close the bug with "cannot reproduce".
Aug ’25
Reply to PCIDriverKit entitlements during development
and here are the bug numbers FB19449747 No developer flavor of PCI transport capability FB19450162 Two indistinguishable PCI transport capabilities shown FB19450508 Xcode hides provisioning profiles FB19451832 indistinguishable USB transport entitlements also, to revert the changes you made to a victim machine: sudo nvram boot-args -c to clear all the boot-args. sudo nvram boot-args --help will tell you more then boot into recovery and perform csrutil enable to turn SIP on again
Topic: Code Signing SubTopic: Entitlements Tags:
Aug ’25
Reply to PCIDriverKit entitlements during development
thank you Kevin for that answer. In the meantime I've discovered a few more facts, which I'll detail here. I'll also file some bugs and attach their numbers here. I did manage to get a PCI driver to match and install on a victim machine. I used an Xcode-generated profile that includes our own PCI entitlement, but installed the driver on a machine with entitlement checks turned off. To do this, on the victim machine: boot into recovery and turn SIP off (csrutil disable at the command line) boot back into the OS, and execute: sudo nvram boot-args="amfi_get_out_of_my_way=1 -arm64e_preview_abi dk=0x8001" reboot to let the boot-args take effect change the architecture of the driver to arm64e (it was ${STANDARD_ARCHS} (in build settings/architectures) It is possible that not all of the boot-args are necessary. I had to change the build architecture because it seems like the other arguments make the OS think that everything is a platform binary. The driver still failed entitlement checks until I added dk=0x8001. All of this information takes a lot of searching to find (some of it comes from these very forums) I then tried making a USB driver for development (for a vendor ID we don't have an entitlement for). On my usual Mac, the driver won't load because the entitlement in my provisioning profile is for a specific vendor ID - I can't choose the development USB transport capability. I would have to deploy this driver on a victim machine with SIP off and the same shenanigans as above. This probably wouldn't affect a team with no USB transport entitlement at all, they'd only be able to choose the development flavor of the capability.
Topic: Code Signing SubTopic: Entitlements Tags:
Aug ’25
Reply to ScreenCapture + CMSampleBuffer logic issue
some code accessed a nil pointer. The code doesn't belong to your process (or else you would have landed in the debugger with a BAD_ACCESS error), instead didStop is called. However, almost undoubtedly your code caused the nil pointer access. Take a close look at how you manage video buffers and read the documentation very carefully. CMSampleBufferCreateCopy doesn't actually copy the buffer's data, for example.
Jul ’25
Reply to ScreenCapture + CMSampleBuffer logic issue
what type of object is a ScreenStreamOutput? I don't see it anywhere in Apple's documentation. I'd expect your app, or a component thereof, to conform to SCStreamOutput protocol. So it should implement a func stream( _ stream: SCStream, didOutputSampleBuffer sampleBuffer: CMSampleBuffer, of type: SCStreamOutputType ) that's where you'd put logic which copies the content of the sampleBuffer into your private circular buffer.
Jul ’25
Reply to About posting app in iOS and MacOS
Please don't use the Comments feature to reply to posts (they don't open by default and watchers don't get notifications for them). Mac apps are bundles, directories with a well-known format and a .app extension. They appear to Finder as single files. If you are building with Xcode, the submission process begins with Archiving, not Building. You Archive your app (Product menu), then open the Organizer (in the Window menu), select the archive you just made, and click Distribute Content. To learn more, begin here https://developer.apple.com/macos/submit/. If you are building with some other tool, you'd be better off asking your question on a forum specific to that tool.
Jun ’25
Reply to bInterfaceNumber for multiple interface usb-cdcacm device
you are right, you can't define multiple interface numbers within one IOKitPersonality. But you can define multiple IOKitPersonalities. IOKitPersonalities is a dictionary of dictionaries. The keys are strings (which can be anything meaningful to you, the OS doesn't care what they are), each value is a dictionary. Copy your dictionary which matches against bInterfaceNumber=1, and modify it to match against bInterfaceNumber=2. I believe the rules outlined still apply. https://developer.apple.com/library/archive/qa/qa1076/_index.html
Jun ’25
Reply to Xcode won't execute code?
in this example: struct ContentView: View { var body: some View { Button("Tap Me") { // Action to perform when the button is tapped print("Button was tapped!") startAccelerometer() } } } you see the error "Cannot find 'startAccelerometer' in scope" because startAccelerometer is outside the scope of the structure ContentView (which begins at its { and ends at its }. The compiler doesn't know you mean the function called startAccelerometer inside your MyViewController class. That's a good thing, because names are often re-used in different places in code. In your more recent example, your ContentView doesn't refer to startAccelerometer, and there is no code to call it (what happened to your button? Your screen is blank and white because that's what an empty content view looks like. Your startAccelerometer function, if called, would call itself again and again until your program ran out of stack space and was terminated. You usually don't need a UIViewController in a SwiftUI app. Interfacing between SwiftUI and UIKit is an advanced topic. I suggest you take a step back and review a few simple SwiftUI projects so you can get the hang of drawing into a window and responding to clicks and drags inside a view. You should also try to learn about basic programming concepts like scope. Or, if you are just desperate to see what is going on with the accelerometer, here is a quick and dirty program which will print the results into the debugger console in Xcode on your Mac while the program runs on your phone. It is not a good example of app design (most code samples are not) import SwiftUI import CoreMotion struct ContentView: View { @State private var motionManager: CMMotionManager = CMMotionManager() var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .onAppear() { if motionManager.isAccelerometerAvailable { motionManager.accelerometerUpdateInterval = 0.1 // 10 updates per second motionManager.startAccelerometerUpdates(to: .main) { (data, error) in guard let accelerometerData = data else { return } let x = accelerometerData.acceleration.x let y = accelerometerData.acceleration.y let z = accelerometerData.acceleration.z // Process the x, y, and z acceleration values here print("X: \(x), Y: \(y), Z: \(z)") } } } } }
Replies
Boosts
Views
Activity
Aug ’25
Reply to Unable to get external display working
does your iPad support anything other than mirroring? See https://support.apple.com/guide/ipad/connect-to-a-display-with-a-cable-ipadf1276cde/18.0/ipados/18.0 Also, you need a touchpad or mouse, because otherwise you can't manipulate windows on the external screen. And you might need an external keyboard too.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Aug ’25
Reply to Xcode Beta (Version 26.0 beta 5 (17A5295f)) Constantly Crashing!
it works for me (M1 MBA and M1 MBP with M1 Pro). If I were you, I'd file a bug, then delete Xcode 26b5 and everything associated with it, then re-install it. If that doesn't work, and you're on a beta of macOS, wipe the Mac and reinstall everything. If it is still a problem, follow up on the bug with new crash logs. If it is fixed, close the bug with "cannot reproduce".
Replies
Boosts
Views
Activity
Aug ’25
Reply to PCIDriverKit entitlements during development
and here are the bug numbers FB19449747 No developer flavor of PCI transport capability FB19450162 Two indistinguishable PCI transport capabilities shown FB19450508 Xcode hides provisioning profiles FB19451832 indistinguishable USB transport entitlements also, to revert the changes you made to a victim machine: sudo nvram boot-args -c to clear all the boot-args. sudo nvram boot-args --help will tell you more then boot into recovery and perform csrutil enable to turn SIP on again
Topic: Code Signing SubTopic: Entitlements Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to PCIDriverKit entitlements during development
thank you Kevin for that answer. In the meantime I've discovered a few more facts, which I'll detail here. I'll also file some bugs and attach their numbers here. I did manage to get a PCI driver to match and install on a victim machine. I used an Xcode-generated profile that includes our own PCI entitlement, but installed the driver on a machine with entitlement checks turned off. To do this, on the victim machine: boot into recovery and turn SIP off (csrutil disable at the command line) boot back into the OS, and execute: sudo nvram boot-args="amfi_get_out_of_my_way=1 -arm64e_preview_abi dk=0x8001" reboot to let the boot-args take effect change the architecture of the driver to arm64e (it was ${STANDARD_ARCHS} (in build settings/architectures) It is possible that not all of the boot-args are necessary. I had to change the build architecture because it seems like the other arguments make the OS think that everything is a platform binary. The driver still failed entitlement checks until I added dk=0x8001. All of this information takes a lot of searching to find (some of it comes from these very forums) I then tried making a USB driver for development (for a vendor ID we don't have an entitlement for). On my usual Mac, the driver won't load because the entitlement in my provisioning profile is for a specific vendor ID - I can't choose the development USB transport capability. I would have to deploy this driver on a victim machine with SIP off and the same shenanigans as above. This probably wouldn't affect a team with no USB transport entitlement at all, they'd only be able to choose the development flavor of the capability.
Topic: Code Signing SubTopic: Entitlements Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to ScreenCapture + CMSampleBuffer logic issue
some code accessed a nil pointer. The code doesn't belong to your process (or else you would have landed in the debugger with a BAD_ACCESS error), instead didStop is called. However, almost undoubtedly your code caused the nil pointer access. Take a close look at how you manage video buffers and read the documentation very carefully. CMSampleBufferCreateCopy doesn't actually copy the buffer's data, for example.
Replies
Boosts
Views
Activity
Jul ’25
Reply to ScreenCapture + CMSampleBuffer logic issue
what type of object is a ScreenStreamOutput? I don't see it anywhere in Apple's documentation. I'd expect your app, or a component thereof, to conform to SCStreamOutput protocol. So it should implement a func stream( _ stream: SCStream, didOutputSampleBuffer sampleBuffer: CMSampleBuffer, of type: SCStreamOutputType ) that's where you'd put logic which copies the content of the sampleBuffer into your private circular buffer.
Replies
Boosts
Views
Activity
Jul ’25
Reply to About posting app in iOS and MacOS
Please don't use the Comments feature to reply to posts (they don't open by default and watchers don't get notifications for them). Mac apps are bundles, directories with a well-known format and a .app extension. They appear to Finder as single files. If you are building with Xcode, the submission process begins with Archiving, not Building. You Archive your app (Product menu), then open the Organizer (in the Window menu), select the archive you just made, and click Distribute Content. To learn more, begin here https://developer.apple.com/macos/submit/. If you are building with some other tool, you'd be better off asking your question on a forum specific to that tool.
Replies
Boosts
Views
Activity
Jun ’25
Reply to bInterfaceNumber for multiple interface usb-cdcacm device
you are right, you can't define multiple interface numbers within one IOKitPersonality. But you can define multiple IOKitPersonalities. IOKitPersonalities is a dictionary of dictionaries. The keys are strings (which can be anything meaningful to you, the OS doesn't care what they are), each value is a dictionary. Copy your dictionary which matches against bInterfaceNumber=1, and modify it to match against bInterfaceNumber=2. I believe the rules outlined still apply. https://developer.apple.com/library/archive/qa/qa1076/_index.html
Replies
Boosts
Views
Activity
Jun ’25