Hi, I'm looking for a way to integrate clang-tidy rules with my xcode project. is there a way xcode can read .clang-tidy files and add the rules to each compilation line ?
I couldn't find anyway to do it, so i presume it's unsupported. but perhaps there can be some workaround i can use to modify the compilation according to clang-tidy rules that the IDE read from a file.
thanks !
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
I've built an installation package (file with .pkg suffix).
when I double click the pkg file whereas newer version of the package is already installed, then the installer skip the downgrade process due to the following reason.
2023-02-22 20:19:11+02 my-Mac installd[744]: PackageKit: Skipping component
“com.myapp.mycompany” (22.9.0-2209.0.0-*)
because the version 23.2.3559-2302.3559.11638-* is already installed at /Applications/myapp.app.
However, I still see that the preinstall and postinstall script being executed.
Perhaps there's a way to either enable the downgrade, or disable it completely, so I won't get this partial install scenario.
Is there a way I can get indication that the installer has skipped the file copying of the target pkg, from within the post/pre install scripts (so I can handle it properly) ?
Hi,
I am using xcode build that receive it's configuration using xcconfig files, those add some new definitions to the project, like the location of openssl library.
If xcode environment variable include prefix that matches one of the fields in the project settings, it is automatically referred to as if you added it to that field.
for example : the var HEADER_SEARCH_PATHS_openssl_libopenssl has value (openssl headers' path) that should be automatically added to the field Headers Search Paths under project settings.
For some reason it stopped working for me and i'm not sure why (i've tried to release the xcconfig files). any idea why ?
Thanks !
Hi, I'd like to write a network extension for a vpn product, that also filter several types of packets before they arrive to the tunnel represeted by the tunnel virtual interface (utun0)
Is there anyway I can set the packet filtering to occur before the tunnel ? is it the default case ?
Can I use the same network extension for both NEPacketTunnelProvider and NEFilterPacketProvider / NEFilterDataProvider ?
thanks !
Hi,
I've got an object from type NSURLSessionWebSocketTask from which I create webSocket.
However, currently it can only receive responses as can be seen here:
NSURLSessionWebSocketMessage * msg = [[NSURLSessionWebSocketMessage alloc] initWithString:myStringBody;
[socketConnection sendMessage:msg completionHandler: ^(NSError * e) {
if (e == nil) {
[socketConnection receiveMessageWithCompletionHandler:^(NSURLSessionWebSocketMessage * _Nullable message, NSError * _Nullable error) {
NSLog(@"got message = %@", message.string);
}];
}];
I'd like to be able to receive messages from server that wasn't triggered from client request (messages that initiated by the server).
Ideally, i wish to get them in some sort of queue (maybe NSOperationQueue or dispatch queue). But the bottomline should be that some listener would work in the background.
Perhaps there's some delegate to implement this requirement ?
I'd like to get an indication about the context in which my process is running from. I'd like to distinguish between the following cases :
It runs as a persistent scheduled task (launchDaemon/launchAgent)
It was called on-demand and created by launchd
using open command-line or double-click.
It was called directly from command-line terminal (i.e. > /bin/myProg from terminal )
Perhaps is there any indication about the process context using Objective-c/swift framework or any other way ?
I wish to avoid inventing the wheel here :-)
thanks
Topic:
App & System Services
SubTopic:
Core OS
Tags:
macOS
Swift Packages
Objective-C
Inter-process communication
Consider a C++ method that retrieve struct of native typed arguments like enum class, sub-structs, std::string, int, etc...
I'd like to create a swift API that return the same struct but in swift variables
for example :
class ErrorMessage {
public:
int status;
std::string message;
};
class serverResponse {
public:
ErrorMessage error;
std::string str_value;
std::uint16_t int_val;
std::time_t last_seen;
EnumVal status;
};
serverResponse getServerResponse();
So I'd like to convert it to the swift equivalent struct with native members
open class serverResponseSwift : NSObject {
open class var error: ErrorMessage { get }
open var str_value: String { get }
open var int_val: UInt16 { get }
open var status: EnumVal { get }
};
I know that direct conversion is not yet possible so I need to use objective-C++ code as a mediator. So I've used a bridging header to include the converting method in objective-C++ which will look like this :
@interface Converter
- (serverResponseSwift) getServerStatusSwift;
@end
and the equivalent .mm file will implement the conversion function, but can I use the swift Class in objective-c in order to fill it up according to the CPP serverResponse ?
@implementation Converter
- (serverResponseSwift) getServerStatusSwift {
serverResponse x = getServerResponse();
/// How do I create serverResponseSwift out of serverResponse
}
Thanks !
Hi,
I’d like to perform client-side certificate authentication from https based connection in macOS.
I’m using the method didReceiveChallenge from URLSession. However, I cannot read the keychain directly since my process is running as Daemon, and my client certificate reside in login keychain.
So I've followed the guidance from this question https://developer.apple.com/forums/thread/106851, and sent this authentication request to a user-based process which is running in the current user so it has access to the keychain.
After I acquire the NSURLCredential object, I’d like to return it back to the Daemon, so it may run the completionHandler with that credential.
However, After I successfully create the NSURLCredential in the user process, and send it back using some reply callback. It looks like the object didn’t serialized properly and I get the following error :
Exception: decodeObjectForKey: Object of class "NSURLCredential" returned nil from -initWithCoder: while being decoded for key <no key>
Here’s my client side code ( I made sure that the server side create a valid NSURLCredential object).
and the problem occur after I send the XPC request, right when i’m about to get the callback response (reply)
- (void)URLSession:(NSURLSession *)session
didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodClientCertificate) {
[myXpcService getCertIdentityWithAcceptedIssuers:challenge.protectionSpace.distinguishedNames
withReply:^(NSURLCredential *cred, NSError *error) {
if (error != nil) {
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
} else {
completionHandler(NSURLSessionAuthChallengeUseCredential, cred);
}
}];
}
Perhaps anybody can tell me what did I do wrong here ? Does XPC is capable to pass complex objects like NSURLCredentials ?
thanks !
Topic:
App & System Services
SubTopic:
General
Tags:
Foundation
Inter-process communication
XPC
Network Extension
Hi,
I'm using the reachability framework in order to register network status event for a specific address (address_st in the code below)...
I'd like to support change of address which will trigger unregister from the old address and register to the new one. How can it be done ?
SCNetworkReachabilityRef reachabilityRef =
SCNetworkReachabilityCreateWithAddress(NULL, reinterpret_cast<sockaddr *>(&address_st));
SCNetworkReachabilityContext context = {0, NULL, NULL, NULL, NULL};
SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
SCNetworkReachabilitySetDispatchQueue(reachabilityRef,
dispatch_queue_create("com.reachability.test", nil));
thanks,
Hi,
I've developed network extension that is being loaded from container application.
Currently, i'd like to test the extension using development profile in signature.
I've implemented 4 providers inside the extension, each derived from NE basic class. here are the definitions of my providers :
@interface myAppProxyProvider : NEAppProxyProvider
@interface myFilterDataProvider : NEFilterDataProvider
@interface myFilterPacketProvider : NEFilterPacketProvider
@interface myDnsProxyProvider : NEDNSProxyProvider
and added them in the Info.plist accordingly:
<key>NetworkExtension</key>
<dict>
<key>NEMachServiceName</key>
<string>MY_TEAM_ID.com.myBrand.ext</string>
<key>NEProviderClasses</key>
<dict>
<key>com.apple.networkextension.app-proxy</key>
<string>myAppProxyProvider</string>
<key>com.apple.networkextension.dns-proxy</key>
<string>myDnsProxyProvider</string>
<key>com.apple.networkextension.filter-data</key>
<string>myFilterDataProvider</string>
<key>com.apple.networkextension.filter-packet</key>
<string>myFilterPacketProvider</string>
</dict>
</dict>
I also gave the extension proper entitlements, that my developer provision profile supports.
<dict>
<key>com.apple.application-identifier</key>
<string>MY_TEAM_ID.com.myBrand.ext</string>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>app-proxy-provider</string>
<string>content-filter-provider</string>
<string>packet-tunnel-provider</string>
<string>dns-proxy</string>
<string>
</array>
<key>com.apple.developer.team-identifier</key>
<string>MY_TEAM_ID</string>
<key>com.apple.security.application-groups</key>
<array>
<string>MY_TEAM_ID.myGroup.com</string>
</array>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
First, I activate the extension from the container app, so it set to [activated enabled]
Then, In order to spawn the xpc client process, I start the xpc connection from the container application. but the process gets immediate exception and crash right after startup for the following reason :
System Integrity Protection: enabledCrashed Thread: 0 Dispatch queue: com.apple.main-threadException Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001aab620f8
Exception Note: EXC_CORPSE_NOTIFYTermination Reason: Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process: exc handler [1268]Application Specific Information:
Configuration error: Couldn’t retrieve XPCService dictionary from service bundle.
The problem may hint wrong configuration of the Info.plist, no ? Any idea what can lead to this ?
Thanks
Hi,
I'd like to allow only a specific process to read sensitive items from keychain (based on process signature using method SecItemCopyMatching), and fail any other read attempt.
Is it possible, what are the access control rules I can define for keychain access if this is not possible ?
I'm now using the default user keychain, perhaps I should create a different keychain with non-trivial access control, so that not all processes that are running with user context or even with root privileges, would be able to get the data.
Thanks
Here's my read example :
func read(service: String, account: String) -> Data? {
let query = [
kSecAttrService: service,
kSecAttrAccount: account,
kSecClass: kSecClassGenericPassword,
kSecReturnData: true
] as CFDictionary
var result: AnyObject?
SecItemCopyMatching(query, &result)
return (result as? Data)
}
I'm using NETransparentProxyProvider to intercept udp sockets using the method handleNewUDPFlow. An application may create a UDP socket and set the DONTFRAG using setsockopt method
setsockopt(s, IPPROTO_IP, IP_DONTFRAG, &val, sizeof(val))
In this case, do I have option in this case, to get the connection settings inside the callback
(void)handleNewUDPFlow:(NEAppProxyUDPFlow *)flow initialRemoteEndpoint:(NWEndpoint *)remoteEndpoint;
So in this case, I would be able to create the outgoing socket with the exact same characteristics, after the original app socket got intercepted by my proxy provider ?
Hi, I've noticed a weird behavior happening on Sequoia with DF bit:
On machine where SIP is disabled, when I do /sbin/ping -D -s 1400 8.8.8.8 I do see the DF bit in wireshark
On machine where SIP is enabled, when I do /sbin/ping -D -s 1400 8.8.8.8 I do not see the DF bit in wireshark
The -D flag should set the DF bit but for some reason it doesn’t if the SIP is enabled.
Perhaps there was any change in permission/entitlements mechanism in Sequoia that can explain it ? I'm using the built-in ping command so maybe it should be signed with more entitlements ?
We are experiencing abnormal battery drain during sleep on several machines that installed our product. The affected devices appear to enter and exit sleep repeatedly every few seconds, even though the system logs show no new wake request reasons or changes in wake timers.
Symptoms:
Battery drops ~1% every ~15–20 minutes overnight.
pmset -g log shows repeated "Entering Sleep" and "Wake Requests" events every few seconds.
Wake requests remain unchanged between cycles and are scheduled far into the future (i.e. 20+ minutes later), yet the log lines keep repeating.
On healthy machines, the same wake request entries appear only once every 20–30 minutes as expected, with minimal battery drop during sleep (~1% in 9 hours).
What we've checked:
No user activity (system lid closed, device idle).
No significant pmset -g assertions; only powerd and bluetoothd are holding expected PreventUserIdleSystemSleep.
pmset -g on affected machines shows sleep set to 0, likely due to sleep prevented by powerd, bluetoothd.
No third-party daemons are holding assertions or logging excessive activity.
Sample Logs from Affected Machine:
2025-06-28 21:57:29 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=active Using Batt (Charge:76%) 3 secs
2025-06-28 21:57:31 Wake Requests [process=mDNSResponder request=Maintenance deltaSecs=7198 wakeAt=2025-06-28 23:57:29 ...]
2025-06-28 21:57:38 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=active Using Batt (Charge:76%) 3 secs
2025-06-28 21:57:40 Wake Requests [process=mDNSResponder request=Maintenance deltaSecs=7198 wakeAt=2025-06-28 23:57:38 ...]
2025-06-28 21:57:47 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=active Using Batt (Charge:75%) 3 secs
2025-06-28 21:57:49 Wake Requests [process=mDNSResponder request=Maintenance deltaSecs=7198 wakeAt=2025-06-28 23:57:47 ...]
The only change in logs is the wakeAt timestamp being slightly updated . The wake requests themselves (process, type, deltaSecs) remain identical. Yet, the system keeps entering/exiting sleep every few seconds, which leads to power drain.
We would appreciate your help in identifying:
Why the sleep/wake cycles are repeating every few seconds on these machines.
Whether this behavior is expected under certain conditions or indicates a regression or misbehavior in power management.
How we can trace what exactly is triggering the repeated wake (e.g., a subsystem, implicit assertion, etc.).
Whether there are unified log predicates or private logging options to further trace the root cause (e.g., process holding IO or waking CPU without explicit assertion).
We can provide access to full logs, configuration profiles, and system diagnostics if needed.
Hi, I have a VPN product for macOS. When activated, it creates a virtual interface that capture all outgoing traffic for the VPN. the VPN encrypt it, and send it to the tunnel gateway. The gateway then decapsulates the packet and forwards it to the original destination.
To achieve this, The vpn modifies the routing table with the following commands:
# after packets were encoded with the vpn protocol, re-send them through
# the physical interface
/sbin/route add -host <tunnel_gateway_address_in_physical_subnet> <default_gateway> -ifp en0 > /dev/null 2>&1
# remove the default rule for en0 and replace it with scoped rule
/sbin/route delete default <default_gateway> -ifp en0 > /dev/null 2>&1
/sbin/route add default <default_gateway> -ifscope en0 > /dev/null 2>&1
# create new rule for the virtual interface that will catch all packets
# for the vpn
/sbin/route add default <tunnel_gateway_address_in_tunnel_subnet> -ifp utunX > /dev/null 2>&1
This works in most cases. However, there are scenarios where the VPN process may crash, stop responding, or another VPN product may alter the routing table. When that happens, packets may no longer go out through the correct interface.
Question: Is there a way to reliably reconstruct the routing table from scratch in such scenarios? Ideally, I would like to rebuild the baseline rules for the physical interface (e.g., en0) and then reapply the VPN-specific rules on top. Are there APIs, system utilities, or best practices in macOS for restoring the original routing configuration before reapplying custom VPN routes?
Thanks