Hello,
As of iOS 17, the keyboard app runs in a different process. I was wondering if there is a way to access the UIView of the keyboard app or if there is a way to subscribe to touch events done on the keyboard (especially during the trackpad mode).
By trackpad mode I mean when the user long presses on space and then can move in the keyboard area (that turns into a trackpad) to move the caret in a text.
Either Objective C or SwiftUI is fine.
Thanks!
Inter-process communication
RSS for tagShare data through Handoff, support universal links to your app's content, and display activity-based services to the user using inter-process communication.
Posts under Inter-process communication tag
14 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I am working on an App and I am in the process of adding Syphon support.
Syphon uses CFMessagePort for IPC and passing of FrameBuffer data (MTLTexture) between apps - and is widely used in the professional video app and video production space.
What I have noticed is that when the App is built as a Sandbox app, during the Syphon initialization, I see the following error message in the log:
*** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8703, name = 'info.v002.Syphon.D2499DBD-93AE-4CEA-B21F-FF356DCC069D'
See /usr/include/servers/bootstrap_defs.h for the error codes.
Syphon uses the "info.v002.Syphon.UUID" naming convention to identify IPC Syphon servers, so I don't think I can use the App Groups naming convention for Sandbox support.
I have a very simple example app on github that publishes SpriteKit frames as a Syphon Server. To see the issue, simply enable App Sandbox for the build, and run the app. You should see the error message in the log and no data appears in any Syphon Client (I use Syphon Recorder for testing - available at syphon.github . io
I am looking for other options to enable CFMessagePorts on a Sandbox App.
Hi
There is a critical code section between the app and its app extensions that needs to be synchronized and done atomically.
What would be a suitable solution to achieve locking and synchronization between app’s processes? Is there a way to share memory or an operation queue between the app and its app extensions?
Thank you
Hi,
I have two iOS apps in the same app group. Now App 1 wants to execute a method in App 2 via IPC:
App 1 -> call method test() via IPC on App 2 -> App 2 returns the result to App 1.
Is this possible?
Regards,
I have used
[[NSDistributedNotificationCenter defaultCenter] addObserver
in process AA to listen notification from other process BB, It works fine.
But when make the observer process AA as a launch daemon (which is started by launchd), It found below difference.
If run process BB as root privilege, AA can not receive notification posted by BB.
If make process BB as a launch daemon, AA can receive notification posted by BB.
What was happened in above difference, It can not find any document about this, Thanks.
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
}
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?
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!
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.
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!
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.
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
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.
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?