I want to make an agent application in SwiftUI.
It would be setup as a login item and have no dock icon and display no windows on start.
I used AlertScene at first, but it is unavailable on macOS 14 which is my deployment target.
Is there a way to have no windows or I'd better use AppKit for that?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I want to install Chrome extension via configuration profile without user needing to go to System Settings and install profile manually.
Can i install configuraation profile by making user only interact with my app?
I'm trying to use ASWebAuthenticationSession on macOS but there is a weird crash and I have no idea what to do.
It looks like there is a main thread check in a framework code that I have no control over.
Any help would be appreciated.
Thank you in advance.
The stack of crashed thread has no symbols, even for supposedly my code in OAuthClient.authenticate.
macOS 15.4.1 (24E263)
Xcode Version 16.3 (16E140)
Thread 11: EXC_BREAKPOINT (code=1, subcode=0x10039bb04)
Thread 12 Queue : com.apple.NSXPCConnection.m-user.com.apple.SafariLaunchAgent (serial)
#0 0x0000000100b17b04 in _dispatch_assert_queue_fail ()
#1 0x0000000100b52834 in dispatch_assert_queue$V2.cold.1 ()
#2 0x0000000100b17a88 in dispatch_assert_queue ()
#3 0x000000027db5f3e8 in swift_task_isCurrentExecutorWithFlagsImpl ()
#4 0x00000001022c7754 in closure #1 in closure #1 in OAuthClient.authenticate() ()
#5 0x00000001022d0c98 in thunk for @escaping @callee_guaranteed (@in_guaranteed URL?, @guaranteed Error?) -> () ()
#6 0x00000001c7215a34 in __102-[ASWebAuthenticationSession initWithURL:callback:usingEphemeralSession:jitEnabled:completionHandler:]_block_invoke ()
#7 0x00000001c72163d0 in -[ASWebAuthenticationSession _endSessionWithCallbackURL:error:] ()
#8 0x00000001c7215fc0 in __43-[ASWebAuthenticationSession _startDryRun:]_block_invoke_2 ()
#9 0x0000000194e315f4 in __invoking___ ()
#10 0x0000000194e31484 in -[NSInvocation invoke] ()
#11 0x00000001960fd644 in __NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK__ ()
#12 0x00000001960fbe40 in -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] ()
#13 0x00000001960fb798 in __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_3 ()
#14 0x0000000194a6ef18 in _xpc_connection_reply_callout ()
#15 0x0000000194a6ee08 in _xpc_connection_call_reply_async ()
#16 0x0000000100b3130c in _dispatch_client_callout3_a ()
#17 0x0000000100b362f8 in _dispatch_mach_msg_async_reply_invoke ()
#18 0x0000000100b1d3a8 in _dispatch_lane_serial_drain ()
#19 0x0000000100b1e46c in _dispatch_lane_invoke ()
#20 0x0000000100b2bfbc in _dispatch_root_queue_drain_deferred_wlh ()
#21 0x0000000100b2b414 in _dispatch_workloop_worker_thread ()
#22 0x0000000100c0379c in _pthread_wqthread ()
My code:
@MainActor
func authenticate() async throws {
let authURL = api.authorizationURL(
scopes: scopes,
state: state,
redirectURI: redirectURI
)
let authorizationCodeURL: URL = try await withUnsafeThrowingContinuation { c in
let session = ASWebAuthenticationSession(url: authURL, callback: .customScheme(redirectScheme)) { url, error in
guard let url = url else {
c.resume(throwing: error ?? Error.unknownError("Failed to get authorization code"))
return
}
c.resume(returning: url)
}
session.presentationContextProvider = presentationContextProvider
session.start()
}
let authorizationCode = try codeFromAuthorizationURL(authorizationCodeURL)
(storedAccessToken, storedRefreshToken) = try await getTokens(authorizationCode: authorizationCode)
}
Here is disassembly of the crashed function.
libdispatch.dylib`_dispatch_assert_queue_fail:
0x10067fa8c <+0>: pacibsp
0x10067fa90 <+4>: sub sp, sp, #0x50
0x10067fa94 <+8>: stp x20, x19, [sp, #0x30]
0x10067fa98 <+12>: stp x29, x30, [sp, #0x40]
0x10067fa9c <+16>: add x29, sp, #0x40
0x10067faa0 <+20>: adrp x8, 71
0x10067faa4 <+24>: add x8, x8, #0x951 ; "not "
0x10067faa8 <+28>: adrp x9, 70
0x10067faac <+32>: add x9, x9, #0x16b ; ""
0x10067fab0 <+36>: stur xzr, [x29, #-0x18]
0x10067fab4 <+40>: cmp w1, #0x0
0x10067fab8 <+44>: csel x8, x9, x8, ne
0x10067fabc <+48>: ldr x10, [x0, #0x48]
0x10067fac0 <+52>: cmp x10, #0x0
0x10067fac4 <+56>: csel x9, x9, x10, eq
0x10067fac8 <+60>: stp x9, x0, [sp, #0x10]
0x10067facc <+64>: adrp x9, 71
0x10067fad0 <+68>: add x9, x9, #0x920 ; "BUG IN CLIENT OF LIBDISPATCH: Assertion failed: "
0x10067fad4 <+72>: stp x9, x8, [sp]
0x10067fad8 <+76>: adrp x1, 71
0x10067fadc <+80>: add x1, x1, #0x8eb ; "%sBlock was %sexpected to execute on queue [%s (%p)]"
0x10067fae0 <+84>: sub x0, x29, #0x18
0x10067fae4 <+88>: bl 0x1006c258c ; symbol stub for: asprintf
0x10067fae8 <+92>: ldur x19, [x29, #-0x18]
0x10067faec <+96>: str x19, [sp]
0x10067faf0 <+100>: adrp x0, 71
0x10067faf4 <+104>: add x0, x0, #0x956 ; "%s"
0x10067faf8 <+108>: bl 0x1006b7b64 ; _dispatch_log
0x10067fafc <+112>: adrp x8, 108
0x10067fb00 <+116>: str x19, [x8, #0x2a8]
-> 0x10067fb04 <+120>: brk #0x1
We have a Privileged Helper tool that we install with SMJobBless. I would like to debug it.
I've added WaitForDebugger in our helper tool launchd plist and it does wait.
But I can't attach to it via Debug->Attach to Process in Xcode with error:
Code: 3
Failure Reason: tried to attach to process as user 'myusername' and process is running as user 'root'
I set Debug process as: root in scheme settings. But I'm not sure if it does anything since I'm not running this particular scheme at the moment of attach.
I tried unsuccessfully to set "Wait for the executable to be launched" but I had to create a new scheme for it since helper is built as part of the main app so maybe I did something wrong.
Am I doing something wrong or is it not possible to attach to root process?
I want to traverse my local Google Drive folder to calculate the size of all the files on my drive.
I'm not interested in files or directories that are not present locally.
I use getattrlistbulk for traversing and it takes way too much time. I think it is because FileProvider tries to download metadata for the directories that are not yet materialised.
Is there a way to skip non-materialised directories?
It looks like macOS Sonoma doesn't delete /tmp files in containers periodically or on reboot, like it does for system /tmp or $TMPDIR.
Is it a bug or is it in on purpose?
Our app didn't delete its temp files and some users have quite a few of them.
We will make the fix so that we clear after ourselves in the future but should we delete temp files manually on start for existing users?
I know that system /tmp and $TMPDIR are cleaned periodically and on reboot, but what about /tmp directory inside app containers?
Because it looks like on macOS Sonoma it is not cleaned automatically and I was wondering if it is by design? And what should I do about it? Should I delete these files manually for existing users or is it possible to somehow nudge macOS into doing it?