Inter-process communication

RSS for tag

Share data through Handoff, support universal links to your app's content, and display activity-based services to the user using inter-process communication.

Inter-process communication Documentation

Posts under Inter-process communication tag

12 Posts
Sort by:
Post not yet marked as solved
5 Replies
423 Views
We have app and notification extension both loading an agent lib to access the same files with read/write/delete operations. To avoid app and notification extension access the file simultaneously, we use boost::interprocess::file_lock when app enters foreground and notification extension didReceive notifications. If extension failed to grab file lock, it will skip loading agent and returns. If app failed to grab file lock, it will start a timer to keep trying while UI will display spinner. Sometimes we saw crash report from our app with: Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: RUNNINGBOARD 3735883980 Triggered by Thread: 0 The code 3735883980 indicate "deadlock" - The operating system terminated the app because it held on to a file lock or SQLite database lock during suspension. In sysdiagnose, we also see "[osservice<com.apple.InputUI>:1496] check if suspended process is holding locks" in runningboardd process. Does it mean that our app fail to unlock? We did lock when app enters foreground and unlock when app goes to background. Is there anything we did wrong? @implementation FileLock -(id)init { self = [super init]; if (nil != self) { // Find empty lock file, created if it doesn't exist. FILE *file = fopen(lockFile.c_str(), "a"); if (file) { fclose(file); } m_lock = boost::make_shared<boost::interprocess::file_lock>(lockFile.c_str()); } return self; } -(BOOL)lock { return m_lock->try_lock(); } -(void)unlock { return m_lock->unlock(); } @end func applicationDidBecomeActive(_ application: UIApplication) { if !bFileLockAcquired { if fileLock.lock() { bFileLockAcquired = true // load agent } else { lockTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true, block: { _ in DispatchQueue.main.async { if fileLock.lock() { self.lockTimer?.invalidate() self.lockTimer = nil bFileLockAcquired = true // load agent } } }) } } func applicationDidEnterBackground(_ application: UIApplication) { self.lockTimer?.invalidate() self.lockTimer = nil fileLock.unlock() bFileLockAcquired = false }
Posted
by yingha.
Last updated
.
Post marked as Apple Recommended
7.9k Views
I have successfully implemented Universal Links so that a visitor to specific URLs on our site is redirected to one of our apps. It all works well. Alarmingly well, in that it all worked perfectly first time. (I blame the documentation). A question I can't find specifically addressed in the documentation is: what if we have two apps that can both handle a given link? This is in fact our situation. In most cases users will have one or other of the apps installed. The correct behaviour would then be to direct the user to the installed app. In some cases the user will have both apps installed. In that case the ideal behaviour would be to direct the user to what we have defined to be the "main" app. It looks to me as if it is possible to two apps in an apple-app-site-association file, but not having found this in the documentation, I wonder: has anyone on here actually tried this? Did it work as expected?
Posted Last updated
.
Post not yet marked as solved
3 Replies
217 Views
My goal is to create a communication mechanism between the UI test runner and my app. That way I can tell the app to display specific data (without laboriously going through the UI steps of getting the app into that state) and also read the values stored as a result of simulated user actions. So, what are the best options for that kind of IPC? So far I have tried NWListener and friends, but it looks like I'd have to add entitlements to my app, which I'd rather avoid since this is only for testing. Can I have the app listening for some kind of IPC connection without requiring entitlements?
Posted
by Uncommon.
Last updated
.
Post not yet marked as solved
3 Replies
266 Views
Hello, we are currently working on a plan to migrate our app suite from Developer ID binaries inside a simple pkg installer to macOS app store distribution. The reason we are using an installer is that there are multiple binaries inside that communicate via XPC and we need to install the respective launchd plist in /Library/LaunchDaemons and /Library/LaunchAgents: 1 root daemon 1 agent that has minimal UI and lives in the system menu bar 1 embedded command line utility in user agent 1 embedded FileProvider extension in user agent 1 embedded Action Extension in user agent 1 agent that only does OAuth stuff Looking through Updating helper executables from earlier versions of macOS I can install the root daemon with SMAppService.daemon(plistName:) and the OAuth helper with SMAppService.agent(plistName:). For the main application I only found SMAppService.mainApp which does not accept a property list configuration. Therefore, I have no place to put my MachServices array and so the File Provider extension, the Action Extension, and the embedded command line utility have no way to talk to the user agent. Currently, XPC is used in between these processes: user agent -> root daemon command line utility -> user agent action extension -> user agent file provider extension -> user agent user agent -> file provider extension: that already works through NSFileProviderServicing I know app-to-app communication only works through launchd for security reasons, but these applications are all part of the same app group (except the root daemon obviously). My question is what is the proper way of starting the user agent so XPC from other binaries just work ™️? Any input is much appreciated!
Posted
by WoamaHons.
Last updated
.
Post not yet marked as solved
3 Replies
425 Views
I am looking for a solution to transfer data between two completely separate processes (not from the same group). I did a lot of research, but the solutions were mostly for processes that are in a group. Is there a method? (It doesn't matter if the app is sandboxed, I can disable it). My goal is to communicate between a bundle(plugin) that is activated on the Mac login page and an XPC service and transfer data from the service to the bundle.
Posted
by Jafar96.
Last updated
.
Post marked as solved
6 Replies
2.1k Views
Hi, how could I get the command line arguments of a process given its audit token. My app is a Content Filter Network Extension written in swift. I can obtain the audit token from NEFilterFlow but I can't figure out how to get the process arguments, I was able to get the pid from the audit token using audit_token_to_pid.
Posted Last updated
.
Post not yet marked as solved
1 Replies
480 Views
We have an iOS application that supports the iOS share extension. We notice when a link is shared from Google Maps to other apps, the link automatically gets a "g_st" parameter with the bundle ID of the target app! The bundle ID of the destination share extension app becomes a part of the shared URL dynamically! This is being used as a kind of referrer with links. How is this being done and is this something that's allowed in iOS? For example, if a Google Maps link is shared to the LinkedIn iOS app, the URL changes to contain LinkedIn's share extension bundle ID!
Posted
by cliq.
Last updated
.
Post not yet marked as solved
2 Replies
842 Views
Hey 👋 I have an extension of type "Device Activity Report Extension". Is there a way to know from the parent app if the extension process is alive? the process name is DeviceActivityReportService Why would I like to detect that? The extension sometimes crashes due to memory pressure and I would like to reload the view automatically when this happens. This issue happens under normal app use — the user switches quickly between two tabs that have DeviceActivityReport. I filed a bug for this with a sample project to replicate (12192929) Here is an output from the Console app when the DeviceActivityReportService is killed and the UI disappears: kernel memorystatus: killing process 33061 [DeviceActivityReportService] in high band FOREGROUND (100) - memorystatus_available_pages: 68660 kernel DeviceActivityReportService[33061] Corpse allowed 1 of 5 SpringBoard [xpcservice<com.apple.DeviceActivityUI.DeviceActivityReportService([application<com.labalab.Screen-Time.marcin>:33046])>:33061] Workspace connection invalidated. SpringBoard [xpcservice<com.apple.DeviceActivityUI.DeviceActivityReportService([application<com.labalab.Screen-Time.marcin>:33046])>:33061] Now flagged as pending exit for reason: workspace client connection invalidated SpringBoard [FBInterfaceOrientationServiceServer] Removing client xpcservice<com.apple.DeviceActivityUI.DeviceActivityReportService([application<com.labalab.Screen-Time.marcin>:33046])>:33061. SpringBoard Removed client for observing orientation events: <FBServiceFacilityServerClientHandle: 0x281fa23a0; com.apple.frontboardservices.orientation-observer; xpcservice<com.apple.DeviceActivityUI.DeviceActivityReportService([application<com.labalab.Screen-Time.marcin>:33046])>:33061: remote> kernel 266908.072 memorystatus: killing_specific_process pid 33061 [DeviceActivityReportService] (per-process-limit 100) 35873KB - memorystatus_available_pages: 68793 Screen Time Terminating interface and invalidating assertion: identifier: com.apple.DeviceActivityUI.DeviceActivityReportService; assertion: 0x282316b70 Screen Time Terminating interface and invalidating connection: identifier: com.apple.DeviceActivityUI.DeviceActivityReportService; assertion: 0x0
Posted
by IdeaRoots.
Last updated
.
Post not yet marked as solved
1 Replies
694 Views
We have 2 process in our macOS application Daemon process written in golang Swift application Currently, the communication between both the process are done with Unix domain socket. However, we are seeing significant amount of delay when large amount of data communication. We are looking for some faster communication. Probably XPC is the answer. But not sure how to use XPC between two process which are written in different language. Any sample code would be great help.
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
Hello, (Back story~) for the past few months, I’ve been dealing with a lot of reoccurring issues regarding losing connection to my Wi-Fi, applications running strangely or appearing as an older version of itself, as well disturbances in my cellular data service. I have both my Internet service and my cell service with Xfinity, so I naturally began by talking with one of their support agents. However, this led to no resolution as the agent reported back that everything seemed fine from their back-end console. I wasnt satisfied with that resolution so I began doing my own digging beginning with my home network and router. (Observed Irregularities) Using nmap I received a list of unfamiliar processes that were present on a number of my devices. Of them were both my i-devices showing 3 open ports: Port 1080: Socks Details: SOCKS is an Internet protocol that exchanges network packets between a client and server through a proxy server. SOCKS5 optionally provides authentication, so only authorized users may access a server. Practically, a SOCKS server proxies TCP connections to an arbitrary IP address, and provides a means for UDP packets to be forwarded. SOCKS performs at Layer 5 of the OSI model Port 1083: ansoft-lm-1 (Anasoft License Manager) Details: UDP port 1083 uses the Datagram Protocol, a communications protocol for the Internet network layer, transport layer, and session layer. This protocol when used over PORT 1083 makes possible the transmission of a datagram message from one computer to an application running in another computer. Since UDP is connectionless, it’s up to the application that received the message on Port 1083 to process any errors and verify correct delivery. Port 8021: intu-ec-client (Intuit Entitlement Client) Details: Turns out there is this native launch service com.apple. ftp-proxy.plist living at /System/Library/LaunchDaemons/com.apple.ftp-proxy.plist that fires /us/libexec/ftp-proxy (https://github.com/drduh/macOS-Security-and-Privacy- Guide/blob/master/launchd/15B42 launchd.cs#L94) which apparently binds to TCP port 8021. (Question/Concern) From my understanding, you close an open port by killing the process that currently resides in it. On iPhones the only way to stop a current service provided from an application, is to force quit it from app switcher. But these 3 processes do not appear to be linked to any one application nor is there a provided terminal shell on iPhones to feed it the proper commands to kill the processes. So how do I go about closing them and securing my i-devices?
Posted
by Pinky22.
Last updated
.
Post marked as solved
5 Replies
2.5k Views
Hello, I am facing an issue with NSTask (Process), NSPipe (Pipe) and NSFileHandle (FileHandle). I have an app that executes a child process (command line utility) and gets its output via Pipe instances set as standardI/O of Process instance. I can observe two logic flows: Once the child process exits, -[Process readabilityHandler] gets called where I gather the $0.availableData. Once the child process generates output (i.e. print() is executed by the child process), -[Process readabilityHandler] also gets called which makes sense. This is the case when exit() is not called by the child process (i.e. continuous execution). However, when LLDB is detached, #2 is false, i.e. -[Process readabilityHandler] is not called. Wrong behaviour also happens if I don't rely on readabilityHandler, but instead use Notification to receive changes in data availability. In such case, notification gets called continuously with empty data (even though child process does generate the output). If I don't create Pipe instance for standardI/O of the Process, then readabilityHandler does get called, but with an empty data continuously. I have created a DTS #756462540, since this doesn't make any sense. Prerequisites* app is not sandboxed Big Sur 11.0.1 (20B29) Xcode 12.3 (12C33)
Posted Last updated
.
Post marked as solved
1 Replies
911 Views
Hello All. We have an app that we developed that receives real time data from a bluetooth device, runs it through AI models, and provides some result based on the input. (Sorry for being vague, IP and all). This all works well both on IOS and Android. However, what we want to allow, is for other apps to be able and read the data that we provide in realtime, and display / use that for their own proposes. On android this works really well using a Service. This allows any app to communicate with a single running instance of the service, bind to it, work with the results, and close it when done. I'm trying to understand how we would replicate this on IOS. It seems that the concept doesn't exist, and with the strict limitations on background processing, we cannot just run our app in the background, and stream the results via say a local TCP server that another app can access. What might be the way to solve this within the platform? we have to keep the BT data streaming, our models running, and allow others to access it via some API/RPC. Is there a solution or some sort of best practice to achieve this?
Posted
by SK-Arctop.
Last updated
.