Explore the core architecture of the operating system, including the kernel, memory management, and process scheduling.

Posts under Core OS subtopic

Post

Replies

Boosts

Views

Activity

Existing Xamarin app support on iOS 18
I'm not getting satisfactory answer so I'm trying here to see if there is any workaround. Xamarin support ended in May and our current app (Xamarin forms) crashes on iOS 18 beta. I understand that we may have to upgrade our app to MAUI but is that truly only solution? I'm currently targeting Xcode 15 SDK (iOS 17). Would Xcode 16 SDK for iOS 18 work for Xamarin forms?
4
1
3.8k
Jun ’24
Maximum Number of Bluetooth Pairings (not connections)
Hello, Our app is going to be used in an industrial setting where users will connect to many devices a day via Bluetooth to complete an installation process. They will only connect to one device at a time, so connection limit isn't an issue. What we're wondering about is the limit on number of pairings (found in Settings > Bluetooth > MY DEVICES). This is important because pairings can't be removed programatically. I seem to remember reading somewhere the limit was ~30 devices, but I can't find that document anymore. Does anyone know if this limit is correct, or where I could find a document regarding this?
1
0
1.2k
Jun ’24
Endpoint Security Client doesn't pick up on file writing notifications
Hello, I am writing an Endpoint Security Client application that is supposed to monitor file creation/writing/deletion. It works fine except for one thing - it doesn't pick up changes to the cron jobs file. I am monitoring directory that stores cron job config file and if I would add/delete/write to any new file manually (using for example vim) it will be picked up on by the ES client (yes I know cron files are not meant to be edited manually). But if I want to make changes with command crontab -e then although the contents of the file change, ES client is not sending a notification about it. Any ideas why? Is the mechanism responsible different than just file writing?
1
0
502
Jun ’24
How to do a postorder enumeration of a directory?
How do I accomplish a postorder enumeration of a directory (that is, get subdirectories before the parents)? Normally I would use FileManager.enumerator(at:includingPropertiesForKeys:options:errorHandler:) for enumeration. And there is a DirectoryEnumerationOptions named includesDirectoriesPostOrder. Unfortunately it does not seem to work. If I create the enumerator like this: FileManager.default.enumerator(at: url, includingPropertiesForKeys: resourceKeys, options: [.skipsPackageDescendants, .skipsHiddenFiles, .includesDirectoriesPostOrder]) The enumerator does not provide the results postorder. And in fact if you check the isEnumeratingDirectoryPostOrder, it returns false. Am I using this incorrectly, or is it just broken? Is there some other way to accomplish this? I see that CFURLEnumerator has a similar option, though I don't know if it works any better. Plus I would rather not wrestle with Core Foundation code if I can avoid it.
4
0
819
Jun ’24
Bluetooth — Peripheral Won't Appear in Bluetooth Settings Menu
Xcode 15.3 macOS Sonoma 14.5 I'm trying to build an app for macOS that will emulate a HID device (keyboard, mouse, game controller) and send those inputs to an IOS device over Bluetooth. I've figured out how to map the inputs from the relevant documentation (Human Interface Device Profile 1.1, Apple Accessory Design Guidelines) but I can't seem to get the Bluetooth services working. I've found an example of how to implement the Bluetooth service (from macOS Mojave but updated to Swift 5). The code will build without issue and asks for the necessary permissions in settings. After giving permissions and rebuilding, the peripheral simply does not appear on the iPhone Bluetooth settings menu (or the Bluetooth settings menu of any device). I suppose the question I'm asking here is if macOS Sonoma prevents the macOS device from advertising as a keyboard peripheral. Furthermore, is there any documentation that describes these limitations. Here is the full example code (too large to post): https://github.com/MonoidMusician/Bluetooth-Keyboard-Emulator/blob/master/Keyboard%20Connect%20Open%20Source/BTKeyboard.swift
1
0
585
Jun ’24
Missing Developer Kit Error(Code=34)
sudo kmutil create -n boot -B /usr/share/file/magic/kernelcache -k /Library/Extensions Error Domain=KMErrorDomain Code=34 "Missing Developer Kit: As of macOS 13.0, you will need to install a KDK matching your build 23F79 to rebuild kernel collections." UserInfo={NSLocalizedDescription=Missing Developer Kit: As of macOS 13.0, you will need to install a KDK matching your build 23F79 to rebuild kernel collections.} I'm using KDK 14.5(23F5074a) on macOS 14.5(23F79), and trying to build kernel collection. It seems the kernel debug kit for macOS 14.5(23F79) is not supported. Is there any replacement for macOS 14.5(23F79)?
0
1
629
Jun ’24
Trigger data transfer from watchOS when connectivity is restored
Hello, I have an iOS app and a companion watchOS app. Users record a workout on Apple Watch, the data for which is then transferred using both Watch Connectivity and Core Data + CloudKit (NSPersistentCloudKitContainer) to their iPhone, where it is processed and displayed. As users are recording the workout on their Apple Watch, when they finish and the transfer begins, their iPhone is often not reachable to immediately send the data using Watch Connectivity and they have no network connection (cellular or Wi-Fi). With Watch Connectivity I use transferFile from WCSession, which queues the file for transfer. With Core Data + Cloudkit I save the data and the export is queued. An undetermined amount of time may pass until the user returns to their iPhone or connects to Wi-Fi and most of the time neither of the transfer methods actually transfers the data until the user opens the watchOS app into the foreground, at which point the transfer happens immediately for both methods. I've tried a number of things already, without success, such as: Using sendMessage from WCSession to send an immediate message to the watchOS app when the iOS app returns to the foreground to try and wake the watchOS app up so it can complete the data transfer. On the watchOS app, after attempting to transfer the data, using downloadTask from URLSession to queue a background task to download something, in the hope that it would wake the watchOS app when network connectivity was restored and enable it to complete the data transfer. On the watchOS app, instead of saving the data using NSPersistentCloudKitContainer, using CKRecord and CKDatabase directly to save the data using userInitiated as the quality of service, in the hope that it would be exported once network connectivity was restored. Is there a way to trigger the watchOS app to transfer the data using Watch Connectivity or Core Data + CloudKit in the background when reachabillity or network connectivity is restored, even if the app may have been suspended by watchOS? Many Thanks, Alex
1
0
890
Jun ’24
Virtual serial ports
Hello, I want to add virtual serial ports to a macOS VM (host = Sonoma, guest = Sonoma). Here is what I tried so far: option 1 I create a VZVirtioConsoleDeviceConfiguration and I add a port to it, with a VZFileHandleSerialPortAttachment connected to two pipes: let consoleDeviceConfiguration = VZVirtioConsoleDeviceConfiguration() let guestPort = VZVirtioConsolePortConfiguration() guestPort.isConsole = false guestPort.name = "myserialport" let guestToHostPipe = Pipe() let hostToGuestPipe = Pipe() guestPort.attachment = VZFileHandleSerialPortAttachment( fileHandleForReading: hostToGuestPipe.fileHandleForReading, fileHandleForWriting: guestToHostPipe.fileHandleForWriting ) consoleDeviceConfiguration.ports[0] = guestPort // config is my VZVirtualMachineConfiguration config.consoleDevices = [consoleDeviceConfiguration] Then after the VZVirtualMachine is instantiated, I get the runtime VZVirtioConsoleDevice for my device and I set my service as its delegate. In the guest system, the device is created with the expected name (/dev/cu.myserialport) When I open it (e.g. screen /dev/cu.myserialport 9600), the consoleDevice(_:,didOpen:) delegate method is called as expected. Then I start sending data to hostToGuestPipe.fileHandleForWriting, but I get nothing in my guest system. option 2 Instead of using config.consoleDevices, I add a VZVirtioConsoleDeviceSerialPortConfiguration to config.serialPorts and I use the same scheme as above with a VZFileHandleSerialPortAttachment and two pipes. It works, but: I can't find a way to rename the devices (/dev/cu.virtio, /dev/cu.virtio1, etc) I can't detect when the endpoint is opened/closed. Am I missing something?
3
0
786
Jun ’24
Sequoia Group Container for Mac Catalyst Apps
Prior to Sequoia, Mac Catalyst Apps worked fine when using group folders that started with group. They now get an alert that the Mac Catalyst app is trying to access data from other applications. This may also impact some SwiftUI developers. According to this the documentation for the App Group Entitlements entitlement, on macOS we should begin use the Team Identifier instead of group. Should Mac Catalyst follow the macOS or iOS rules for com.apple.security.application-groups? If they should need to follow the macOS rules now, that creates several issues for developers. We would now need separate build targets to pick up the different Entitlements files. More distressing is that we would need to do some kind of migration process to get our files to the new location. There wouldn't be a transparent way to do so where the user wasn't warned about the application accessing files that don't belong to it. Any clarification on what Mac Catalyst developers should be doing to prepare for Sequoia would be greatly appreciated.
18
5
2.6k
Jun ’24
BLE Background mode for secure printing
Hi, We are developing an app for secure printing using a BLE RFID reader. What we'd like to accomplish is the ability for a user to walk away from the printer (BLE RFID reader) for any time period (10 mins, 1 hour, or 3 hours) with the app still running background mode but out of range from the RFID reader, and walks back to the printer (BLE RFID reader) and be able to connect to the reader thus enabling printing. We've noticed that when the phone is out of range from the BLE reader and phone auto-locks, the background scanning process is terminated after a few minutes. Is there a way to accomplish the above? Any help is appreciated. Thank you, Marlon
1
0
539
Jun ’24
Memory leak in ARC conversion, KVO involved
I'm trying to do a piecemeal conversion of a big macOS Objective-C++ code base to use Automatic Reference Counting (ARC), and started with a fairly complex modal dialog. I converted all the classes involved to use ARC. When the dialog closes, the window itself, and some of the controller objects, get deallocated as they should, but some do not. When I look at the memory debugging graph in Xcode, I see a bunch of things of the form NSKVONotifying_MyClassName. Here's an example: It does not look as though any of my objects have strong references to GRMorphController, so what am I to make of this?
2
0
784
Jun ’24
URL links to default Apps
So I find that I am able to fire up Safari on my phone and I can type the following to get to the relative app: weather:// -> Weather App maps:// -> Maps App wallet:// -> Wallet App music:// -> Music App message:// -> Mail App messages:// -> Messages App Does anyone know a quick link like the ones above for Apple's Translate app? I would love to be able to easily open it via a link.
3
0
483
Jun ’24
My macOS app+helper is not in the System Preferences/Login Item/ "Allow Background" list
I created a macOS app that can run in foreground (NSApplicationActivationPolicyRegular) and in background (NSApplicationActivationPolicyAccessory) and can be launched by an Helper (Login Item) and run in background. I use XCode 15.3 (15E204a) on macOS 14.2.1 on a MacBook Pro 16", 2019, 2,3 GHz Intel Core i9 8 core. I archive my app, I notarize it for direct distribution then I save it to the /Applications folder. Then I delete my Debug app from …/Xcode/DerivedData/MyApp-dal…xu/Build/Products/Debug so I am sure I have one only copy of my app on the disk. I firstly launch my app as NSApplicationActivationPolicyRegular then I select my menu item "Set the app as Login Item". So I call SMAppService *service = [SMAppService loginItemServiceWithIdentifier:@"com.mydomain.Helper"]; I get a service.status == SMAppServiceStatusNotFound So I am stuck. I notice that my app doesn't show up in the System Preferences/Login Items/ "Allow Background" list. So on Terminal I run the command sudo sfltool resetbtm Now the "Allow Background" apps list is empty. Then I reboot. All the apps listed in "Allow Background" list reappear and are all turned "on". I turn them back off. My app is on the list too (turned "on" too). I leave it on. Now I can launch my app as NSApplicationActivationPolicyRegular, select again my menu item "Set the app as Login Item" and call SMAppService *service = [SMAppService loginItemServiceWithIdentifier:@"com.domain.Helper"]; Now I get a service.status == SMAppServiceStatusEnabled so I install the NSStatusItem and switch to background (NSApplicationActivationPolicyAccessory). I can logout and login and my app gets properly launched by the Helper and run in background. Everything works well. I guess I miss something, because I think this is not the way to distribute my app to the customers. I can't ask my customers to run the Terminal command sudo sfltool resetbtm, reboot then turn back "off" all the unwanted apps from the "Allow Background" list then turn my app "on". Furthermore, if I delete my app, it disappears from the "Allow Background" apps list, then if I copy it back to the /Applications folder, it doesn't show up yet in the "Allow Background" apps list. I have to invoke again the sudo sfltool resetbtm Terminal command, reboot… to see it in that list. I tried on 3 machines with macOS 14.2.1. Same result. I have read several articles and posts about NSApplicationActivationPolicyAccessory, SMAppService, but I didn't find my case. The Info.plist file of the Helper properly contains <key>LSBackgroundOnly</key><true/> <key>LSUIElement</key><true/> • What do I miss? • Why my app doesn't show up in the "Allow Background" apps list when I simply copy it within the /Applications folder?
3
0
629
Jun ’24
Path Traversal vulnerability issue
Hi All, I am currently working on piece of code which when I go for a Snaky scan I given me below error. "Unsanitized input from a URL handled via "*File name" flows into moveItem, where it is used as a path. This may result in a Path Traversal vulnerability and allow an attacker to write to arbitrary files." sample code: func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { hadClickOnUrl=true openUrl = url passwordProtetedFilePath = nil ptxData = nil //------------------------------New Code var file:NSString = url.path as NSString var guid = getGuidByFilePath(filepath: file as String) let fileName = FileManager.default.displayName(atPath: file as String) let isGuidAvailabe = DBManager.sharedInstance.iSGuidAlreadyAvilable(guid: guid, fileName: fileName) if(!isGuidAvailabe){ // bundleIdentifier based on the QA or Production Environment let bundleId = Bundle.main.bundleIdentifier print("****************** BundleId based on the QA or Production Env ****************** \(bundleId!)") if(file.contains(bundleId!)){ print("iCloud/Local Drive File") let documentPaths:NSArray = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) as NSArray let documentPath:NSString = documentPaths.object(at: 0) as! NSString let filename:NSString = url.lastPathComponent as NSString let demoTxPath:NSString = NSString.init(format: "%@/%@", documentPath, filename) let importedfilePath = "\(self.getPath())/Inbox/\(filename)" //New : Check if Guid is already exsit in the DB. //If file is not exist in the document folder then processed. if (FileManager.default.fileExists(atPath: importedfilePath as String) != true ) { if (FileManager.default.fileExists(atPath: demoTxPath as String) != true ) { // copy the file from our bundle do{ try FileManager.default.moveItem(atPath: file as String, toPath: demoTxPath as String) //New document path Url file = demoTxPath openUrl = URL(fileURLWithPath: demoTxPath as String) //URL(string: "file:///private\(demoTxPath as String)") guid = getGuidByFilePath(filepath: file as String) }catch let error{ print("error is \(error)") } }else{ print(" iCloud Drive File") //but exist in iCloud Drive let filename:NSString = url.lastPathComponent as NSString let importedfilePath = "\(self.getPath())/\(filename)" guid = getGuidByFilePath(filepath: importedfilePath as String) } }else { guid = getGuidByFilePath(filepath: importedfilePath as String) }// File is already exist based of the file name. }else{ print("Not in iCloud Drive File") //but exist in iCloud Drive let filename:NSString = url.lastPathComponent as NSString let importedfilePath = "\(self.getPath())/Inbox/\(filename)" guid = getGuidByFilePath(filepath: importedfilePath as String) } } I would like to know how to mitigate this issue as I have tried any suggestion give online ,but none of them worked in resolving this issue. Any help would be great thanks in advance.
0
0
392
Jun ’24
Is one step folder creation possible in Finder ?
I need to disallow folder renaming on my NSFileProviderReplicatedExtension extension as my foreign API system changes the asset id when a folder gets renamed and I can't retrieve or compute the new ID. For this reason I disable .allowsRenaming on folders for this volume but the Finder will still trigger the two step create "untitled folder" / rename when creating new folders. I can see that existing folders can't be renamed on the volume so the capability seems properly managed by my extension. Is there a way to prevent the creation of the "untitled folder" folder when creating new folders in Finder on a folder with renaming disabled ?
2
0
706
Jul ’24
Does SystemMemoryReset related to my Application abnormal exit?
Hello, we are currently developing a VPN application. Recently, we have encountered several cases where the Network Extension process terminates unexpectedly. We cannot find any related crash logs on the device, but we can find system SystemMemoryReset logs. The timestamps in these logs closely match (with millisecond accuracy) the times when our VPN process terminated unexpectedly. We have a few questions: 1.How is the SystemMemoryReset event generated, and can this event be avoided? 2.When a SystemMemoryReset occurs, can it cause our VPN background process to be killed or the system to reboot? 3.If the background process can be killed, what conditions need to be met for this to happen, and what methods can we use to prevent the VPN background process from being killed? 4.Based on these logs, does our application have any related issues (the process name is CorplinkTunnel)? Do you have any suggestions for modifications? SystemMemoryReset-2024-06-25-232108.log SystemMemoryReset-2024-06-29-025353.log SystemMemoryReset-2024-07-01-024655.log
1
0
1.4k
Jul ’24
Swift FileManager.default.copyItem(at: URL, to: URL) folder permission error
I'm working on creating a tiny app that copies a random sampling of files from a source folder to a destination folder: https://github.com/belovachap/Select-Random-Files-Mac I choose folders in my user's Documents folder, am able to get the random sampling of files but then run into permission errors when trying to copy to the destination folder. I've tried adding a call to startAccessingSecurityScopedResource on the destination URL but it doesn't seem to help. Is this having the same problems on anyone else's computer??
1
0
566
Jul ’24
Document and data size in ios
We want to give the user the ability to clear "document and data". We first try to calculate the size by summing the size of all the files in that directory FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first. But after calculating the size, we see that the size of the "document and data" that the user sees in the storage is larger than the size of our cache in ios 17. But in earlier versions 16, 15, etc. this directory is not taken into account when calculating the size . Which directories are counted in ios 17? And what directories are taken into account in an earlier version of iOS?
1
0
1k
Jul ’24
Unreal engine project on iOS crashing on open
Hi there, I have just recently had a go at trying to build an app using unreal engine. After much difficulty of finally getting the app to sign, build and deploy I am having issues with the app crashing immediately after opening it. I have had a look at the crash log to find it including EXC_BAD_ACCESS (SIGSEGV) which I've come to understand means it may be accessing a value that doesn't exist. I was unable to understand or figure out any of the rest of it to find any clues on how to solve my issue. If anyone could point me in the right direction as to why the app is crashing, it would be greatly appreciated. crash log
1
0
1.2k
Jul ’24
Inquiry Regarding File Scan Permissions for Anti-Malware Feature Implementation
We need to scan newly created or modified files for malware. To achieve this, we added a plist file in the /Library/LaunchDaemons directory and intended to use a daemon process to perform the scans. However, we have encountered an issue where the daemon process cannot access files within Home subfolders such as ~/Downloads/ and ~/Documents/. When running the process as a user, it fails to scan some files due to lack of read permissions. Conversely, when running the process as root, it cannot scan files in the Home subfolders due to privacy restrictions. Could you please advise on the best approach to achieve this configuration?
3
0
623
Jul ’24