Post marked as unsolved
402
Views
Hello,
this question was asked in various forms a lot on this forum but I'm probably still missing the point, so I would like to ask if anyone can help me to clarify that :)
I have two apps which need to communicate, both are sandboxed, hardened and in the same app group. In my particular setup it's Main.app and Helper.app, where Helper.app is embedded inside the Main.app (but I don't think that's that particularly important, just saying that in case it could be helpful).
I was able to use CFMessagePort to make the communication possible by using port name prefixed with the app group id (like described here) - https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24 that does exactly what I need expect it's not secure, namely I can't verify sender and all communication is basically public (any client knowing the name of the port can send messages there). I understand that CFMessagePort is kinda ancient leftover waiting to be deprecated and from reading its open sourced code from 2015 I understand that this requirements can't be met because (in)security is built in the code :(
I turned my hopes towards XPC and was able to start the NSXPCListener with mach service in the Main.app and connect to the mach service with NSXPCConnection from the Helper.app. Unfortunately that works only from Xcode and I guess it has something to do with the debugserver being parent of the both apps not the launchd. Also for what it's worth, I was not able to verify the sender with SecCodeCopyGuestWithAttributes anyway as I got kPOSIXErrorEPERM (I tried the workaround with entitlement to access /private/var/db/mds).
As I understood from other posts in this forum, this usage pattern is not supported and I have to have meditator in between the apps (the broker), which will allow both apps to exchange NSXPCListenerEndpoint and establish direct communication. Unfortunately again, the XPC service launched as private to the app can't be used for this because the other app can't connect to it, so I have to create .plist for launchd and load the service manually. .
...That's where I got stuck because I don't know how I would get this into App Store. As far as I know the LaunchAgents and Daemons are prohibited and only allowed are LoginItems, which don't seem suited for this to me. Also compared to CFMessagePort this solution with broker is total overkill to problem in the hand, technically I just need to send few "events" between the apps in acceptable time.
So to sum up my "question": Is this XPC wrangling my only option? I was considering using raw mach messaging, which documentation is discouraging from on every step it seems or unix domain socket, which is kinda possessing the same security problems as CFMessagePort.
Sorry for long post and thank you for reading it :)
Post marked as unsolved
101
Views
I am having problems with my serial connection to a microcontroller after uninstalling Wireshark. The behavior wasn't present prior to installing the Wireshark serial sniffer.
Specifically, when I open the USB serial port, a second (duplicate) instance of the port also appears to be active. The steps I took to install and get Wireshark to work on my Mac (Big Sur 11.3) are as follows:
Installed Wireshark app along with ChmodBPF and "Wireshark to system path" installers.
Disabled my Mac's SIP by setting csrutil disabled while in recovery mode
sudo ifconfig XHC20 up
After those steps, I was able to use Wireshark and XHC20 to successfully capture packets from my USB microcontroller. I then uninstalled Wireshark following the instructions and using the provided uninstallers. After turning the XHC20 down and re-enabling the Mac's SIP, I am having the problem.
Specifically, when I open the USB serial port, a second instance of it comes up and I get this output:
• Serial Instance /dev/tty.usbserial-0001 BR: 500000
• Opening Serial port: /dev/tty.usbserial-0001 BR: 500000
The duplicate serial instance did not show up prior to Wireshark and my application was working as expected, and now it doesn't. I am attempting to look for remnants of Wireshark in my filesystem as explained in the instructions for manual uninstall but the instructions are not clear on he location of some items:
Unload the “org.wireshark.ChmodBPF.plist” launchd job. ---- where is this located?
Remove the “access_bpf” group --- where is this located?
/etc/paths.d/Wireshark. ---- can't find such path (including among hidden files)
/etc/manpaths.d/Wireshark. ---- can't find such path
How can I remove the duplicate instance of the serial port??
References: https://developer.apple.com/forums/th... https://developer.apple.com/forums/th... https://developer.apple.com/library/a...
Post marked as solved
140
Views
We define an event handler for OpenURL
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
And we handle it here:
(void)handleGetURLEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
// Handler type stuff
}
If I'm debugging in Xcode, I see a SIGCONT before the handler is called. When I continue from the SIGCONT, I enter the handler and everything is fine.
This causes automated tests to break, and is generally a pain in the you-know-where. Outside of Xcode it's fine.
How can I make it stop doing this? Is there some Xcode setting I've overlooked?
Post marked as unsolved
229
Views
Hi,
How do I communicate between two apps on macOS. For example:- I There are 2 apps - App A and App B. App A wants to wait till App B complete an action.
How do I check whether App B completed an action or not? Which inter process communication is best for implementing it ?
Thanks
Post marked as unsolved
115
Views
Hi,
How do I integrate custom framework into XPC Mach Service and access those functions part of custom framework ?
I have created a XPC Mach service (executable) for providing services to other applications and registered it as launch agent (/Library/LaunchAgents). Service works fine with basic functionalities. I'm able to access services / protocol functions exposed by the Mach Service from another client application and able to retrieve data also from Mach service.
But for certain actions , i need to integrate this XPC Mach service with a custom framework. Integrated in the following way:
Select XPC Mach Service executable in project settings and click on General - Framework & Libraries
Click on + symbol and specify the custom framework from the list and click on add button.
Once it is added into project, open main.swift and import that framework and access the functions inside the framework.
This works fine and compiler is not showing any errors when I build the project.
When i try to access XPC Mach service function, it doesn't return any value. when i check the XPC status using 'launchctl list' command from the terminal, it shows status code as -6 and no process ID is associated for the service. If i remove the custom framework, it works fine.
What should be the issue? how do i resolve it? can i integrate a custom framework into XPC mach service? This is a common framework used by our other apps. Any limitations???
Post marked as unsolved
93
Views
I could see only WWDC videos from 2015 or so in the Developer app.
How to see the old videos?
For example, after much search about XPC, I landed on to this page: https://developer.apple.com/videos/play/wwdc2013/702/
But contents could not be accessed. Getting this:
Safari can’t open the page “devstreaming.apple.com/videos/wwdc/2013/70 2xfx2xmlrics5pyrjfwu2m/702/702.pdf?dl=1” because Safari can’t find the server “devstreaming.apple.com”.
Basically, I am looking for videos to learn about the best practices for XPC.
Another topic I am interested is about how to trust or untrust a URLSession. I could not find a suitable WWDC video on this.
Another topic I am interested to learn is Authorizations (setAuthRef).
Any pointers?
Post marked as unsolved
166
Views
I will be recording instrument and/or vocal tracks for the Question Title content and time is of the essence that I receive the links to have the necessary software for my iMac Pro so that I can record and produce music recordings for my Apple Developer Account, key, orliecar, and his MFI.
Post marked as solved
190
Views
I am developing a desktop application on macOS X.
It is ok to use sem_open("name", O_CREAT, 0644, 0) under console application.
But if it is a desktop application, it would result into a SEM_FAILED. And the error is EPERM(Operation not permitted). Is there any way to use semaphore in this situation?
Cannot find any article to explain something about this. The os version is 10.15.7. Thx a lot.
Post marked as unsolved
133
Views
Hi, there!
In my the following environment, My task (shell script) is not executed by launchd at the specified time. The task was executed by launchd correctly at least about one month ago.
Model: iMac 27-inch 2017
Processor: Intel Core i5
Memory: 8 GB
Graphics: Radeon Pro 570
OS: macOS Big Sur Version 11.1
As checked system log (/var/log/system.log), I saw the following lines. This means that launchd daemon was killed at almost every second by the SIGKILL message from mds. MDS seems to be related to indexing for Spotlight as searched this forum by using the following result.
Jan 31 21:02:12 iMac syslogd[55]: ASL Sender Statistics
Jan 31 21:03:30 iMac com.apple.xpc.launchd[1] (com.apple.mdworker.shared.09000000-0500-0000-0000-000000000000[5075]): Service exited due to SIGKILL | sent by mds[86]
Jan 31 21:05:03 iMac com.apple.xpc.launchd[1] (com.apple.mdworker.shared.09000000-0600-0000-0000-000000000000[5116]): Service exited due to SIGKILL | sent by mds[86]
Jan 31 21:05:44 iMac com.apple.xpc.launchd[1] (com.apple.mdworker.shared.09000000-0700-0000-0000-000000000000[5133]): Service exited due to SIGKILL | sent by mds[86]
Jan 31 21:06:43 iMac com.apple.xpc.launchd[1] (com.apple.mdworker.shared.09000000-0000-0000-0000-000000000000[5158]): Service exited due to SIGKILL | sent by mds[86]
However, I cannot find any useful workaround or solution for this issue. Can you help me?
Post marked as unsolved
278
Views
Hi,
I'm working on creating an xpc service, using the C APIs (gets launched from launchd via plist) and an application that wants to use this service.
Generally it works fine, communication is proper and as expected.
However, in case the service's plist has not been installed in /Library/LaunchDaemons, the client gets stuck! Neither the event handler (set with xpcconnectionseteventhandler) nor the reply block provided to xpcconnectionsendmessagewithreply get called.
If I use xpcconnectionsendmessagewithreplysync() - it never returns!
So how is a client to know that the service is not available in this case?
My assumption was that in such a case the event handler would be called with XPCERRORCONNECTIONINVALID.
Thanks in advance!
Devendra.
Post marked as unsolved
190
Views
TLDR Question - are there any secret flags, environment/apple variables or API, to always execute a native (arm64) executable from a fat binary? Currently rosetta launches x64 executable from x64 process, even if arm64 version is available.
Details:
We have an application that contains multiple executable fles. Our app provides some sort of API usable by third parties. Simplified, we have a library.dylib and executable that does all the work.
The library.dylib gets loaded inside the process and uses posix-spawn to launch the executable.
Both library.dylib and executable are fat binaries: library.dylib is x86,x64 and arm64, executable is x64 and arm64.
Now the issue - rosetta tries to maintain emulation across process boundaries. When x64 process launches another process, rosetta selects x64 binary, even if arm64 binary is available. Is there any way to override this?
If I remove x64 arch from executable fat binary, then arm64 native version is launched, and everything works as expected. Is there any way to pass some flag or environment variable to force posix_spawn to select native binary version, even if called under rosetta?
Thank you.
Post marked as unsolved
228
Views
My MacBook Pro with Touch Bar has 500GB SSD with 8GB LPDDR3 and 2.9 Dual-core intel i5. Only runs 1 startup app (dropbox) in the background. 2 desktop screens (neither in dynamic) and no screensaver. Weather, Calendar and Top Stories are my only widgets. No hot corners. RAM is pretty clean and I'm currently using 299GB of my 499Gb available storage. Most trackpad gestures are active. MacBook has never been dropped, wet, damaged or dismantled and I vacuum the fans generally once per month. Also use anti-malware software for weekly full system scans. Basically, there's no reason my machine's operation should have slowed down yet here we are. Xcode is slower and even local user settings like changing the picture on the admin account is slower. Is Big Sur untraceably consuming so that much RAM? Is my pristine machine really so outdated it can't handle the upgrade? Is Apple pushing me to purchase a newer machine to handle the future upgrades? Is so much UI customization really necessary?
Complaints should always be submitted with solutions.
How to reduce macOS sizes with regard to UI in Big Sur 11.2?
Solution: Create a "average consumer" platform (think GitHub) to allow novice Mac users the availability of open source UI features (downloadable, shareable, un/installable) allowing them more time to make their Mac their own, understand what features they like, don't like, and choose what to keep without loading down OS with all the features up front and perhaps deselecting what we don't like. Users think "hmm. its new... if I kept this feature would I use it? is it easier to do what I was doing instead? is it more work to learn the new mandatory navigation than its worth?" Reduce RAM usage, reduce update file sizes and take a more granularly focused approach on the core and less on the fluff.
We can easily add our own fluff with all the extra time from increased productivity a refined world-class macOS will save us.
Post marked as unsolved
370
Views
I have written C software that makes extensive use of shared memory (200MB using shmget, etc.), which compiled and ran on Mojave and Linux. Using this shared memory required /etc/sysctl.conf to increase the buffer sizes during OSX boot. It appears that Catalina no longer uses my /etc/sysctl.conf file, whether SIP is enabled or disabled. Now the software compiles but fails to run, because the default shared memory size (4MB) is too small on Catalina. How do I specify the shared memory parameters to increase above the default in Catalina?
kern.sysv.shmmax=268435456
kern.sysv.shmmin=1
#kern.sysv.shmmni=128
kern.sysv.shmseg=32
kern.sysv.shmall=65536
Post marked as unsolved
161
Views
Hi,
I'd like to load an xpcService for all active users in advance. Moreover, when new user become active, I want that a dedicated process for that user will be spawn automatically, and not wait for an xpc message.
Here's my plist under /Library/LaunchAgent/:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.service</string>
<key>RunAtLoad</key>
<true/>
<key>EnablePressuredExit</key>
<false/>
<key>POSIXSpawnType</key>
<string>Adaptive</string>
<key>ProgramArguments</key>
<array> <string>/Applications/myApp.app/Contents/XPCServices/myXpcService.xpc/Contents/MacOS/myXpcService</string>
</array>
<key>MachServices</key>
<dict>
<key>com.company.service</key>
<true/>
</dict>
</dict>
</plist>
If I'm using launchctl load than launchd manage the processes for each user which means that the process can be invoked only once an xpc client decides it's needed to raise.
Is there any way to run those processes in advance for all current users, and each additional user which becomes active ?
Post marked as unsolved
173
Views
Hi,
i have some issues to get the values result of a CGI request GET from a camera device.
actually in safari when I paste the local link to my camera with this http request :
://X.X.X.X/cgi-bin/modelreqcgi?action=get
I get this result in safari :
version=1.1.8;model=cbv4pro;
so now I want to get the result and theses fields with her values, but unfortunately with my URL request I never see the values.
please see below my code :
struct ResponseScan: Decodable {
let versionScan: String
let modelScan: String
}
import UIKit
class ViewController: UIViewController {
		
		@IBOutlet weak var messageLabel: UILabel!
		
		@IBOutlet weak var UpdateProgress: UIProgressView!
		
		@IBOutlet weak var Radar: UIButton!
		
		@IBOutlet var UpdateProgressCollection: [UIProgressView]!
		
		
		//:: Action sur le bouton Scan :://
		@IBAction func RadarScan(_ sender: Any) {
		
				let urlScanType = "http://192.168.2.1/cgi-bin/model_req_cgi?action=get"
				
				if let urlScan = URL (string: urlScanType)
				{
						
			 var requestScan = URLRequest (url: urlScan)
						requestScan.httpMethod = "GET"
						
				URLSession.shared.dataTask(with: requestScan) { data, response, error in
						if let data = data {
								print("value de data -> \(String.data)")
								print("value de response -> \(response)")
								do{
										//let jsonData = data.data(using: .utf8)!
								let decoder = JSONDecoder ()
										let jsonData:	ResponseScan = try decoder.decode(ResponseScan.self, from: data)
								print("Version -> \(jsonData.versionScan)")
								print("Modèle -> \(jsonData.modelScan)")
								}
								catch{}
						}
				}.resume()
				print("Finish !!!!!!!!")
				
		}
}
	
is there anybody who can help me please ??
best regards