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

Post

Replies

Boosts

Views

Activity

Usage of IsSIMInserted in iOS 18
I am developing an iOS application where I need to detect if a SIM card is inserted in the device(either physical / eSim). I am targeting iOS 12 and later. I have tried using CTTelephonyNetworkInfo and CTSubscriber, but I am encountering issues with permissions and API availability in iOS 18 beta 3. if #available(iOS 16.0, *) { let subscriber = CTSubscriber() if #available(iOS 18.0, *) { do { if subscriber.isSIMInserted { return "SIM card is inserted." } else { return "No SIM card detected." } } catch { return "Error determining if SIM is inserted: \(error.localizedDescription)" } } else { return "isSIMInserted is only available on iOS 18.0 or newer." } } else { return "isSIMInserted is only available on iOS 16.0 or newer." } if let carriers = networkInfo.serviceSubscriberCellularProviders, let carrier = carriers.first?.value, let _ = carrier.mobileNetworkCode { return "SIM card is available.\nCarrier Name: \(carrier.carrierName ?? "None")" } else { return "No SIM card installed" } } in iOS 18 it always returning No SIM card detected. XCode Version 16.0 beta 3 (16A5202i) iPhone OS: iOS 18.0 (22A5307i) is there anything did I miss? or any documentation for the implementation would be helpful. Thanks
2
0
576
Jul ’24
Universal links & redirect not working on certain devices
We are currently doing our beta testing for our application and we are having some issues with universal links. The issues can be seen below: we are using auth0 for authentication. In this process, after users verify their email addresses they should be redirected back to the application. For some users, they are directed back to a page that shows error 404. For other users where it works, they are directed back to the application. What could be my issue? Our app-site- association file is hosted in the link below for reference. https://yourmomentshub.com/.well-known/apple-app-site-association
6
0
630
Jul ’24
EndPointSecurity system extension crashing due to deadline
Hi , Greetings of the day! I would like to get help to avoid the Endpoint Security System Extension crash due to below reason: Termination Reason: Namespace ENDPOINTSECURITY, Code 2 EndpointSecurity client terminated because it failed to respond to a message before its deadline Couple of events we have subscribed and for AUTH related events we are receiving deadline of 14 seconds in Sonoma and to avoid above issue we have implemented a queue to provide verdict within the deadline to avoid the OS killing of our extension however sometime we observe that we are getting crash with below message: Termination Reason: Namespace ENDPOINTSECURITY, Code 2 EndpointSecurity client terminated because it failed to respond to a message before its deadline **Dispatch Thread Soft Limit Reached: 64** (too many dispatch threads blocked in synchronous operations) There is no GCD API to check whether queue is reached to soft limit so we need help here to know or check whether queue is reached to soft limit 64. if we can check above then we should avoid adding the new tasks in it until its free to accept the tasks. And for NOTIFY_CLOSE, we are getting big value in seconds as deadline however we are adding all the processing of NOTIFY_CLOSE with dispatch_async however still receiving the crash. Here is code for AUTH_OPEN : dispatch_queue_t gNotifyCloseQueue = dispatch_queue_create( "com.example.notify_close_queue", dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT_WITH_AUTORELEASE_POOL, QOS_CLASS_UTILITY, 0)); dispatch_queue_t gAuthOpenQueue = dispatch_queue_create("com.example.auth_open_queue",dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT_WITH_AUTORELEASE_POOL,QOS_CLASS_USER_INTERACTIVE, 0)); BOOL AuthOpenEventHandler(es_message_t *pesMsg) { //Some Processing we are doing here like Calculate the deadline in seconds etc. and we are receiving 14 seconds in Sonoma // deadline - 14 seconds if ( deadlineInSeconds < 10 ) { dispatch_time_t triggerTime = dispatch_time(pesMsg->deadline, (int64_t)(-1 * NSEC_PER_SEC)); __block es_message_t *pesTempMsg; pesTempMsg = es_copy_message(pesMsg); dispatch_after(triggerTime, gAuthOpenQueue, ^{ if (pesTempMsg != NULL) { esRespondRes = es_respond_flags_result(pesClt,pesMsg,pesMsg->event.open.fflag,false); if(ES_RESPOND_RESULT_SUCCESS != esRespondRes) { es_free_message(pesTempMsg); return; } if (pesTempMsg != NULL) { es_free_message(pesTempMsg); } } return; }); } // Some Processing we are doing here to provide verdict and we are making sure that within 11 seconds we are setting the verdict // we are setting iRetFlag here based on verdict if (NULL != pesMsg) { esRespondRes = es_respond_flags_result(pesClt,pesMsg,iRetFlag,false); if(ES_RESPOND_RESULT_SUCCESS != esRespondRes) { es_free_message(pesMsg); return FALSE; } } return TRUE; } Here is the code for NOTIFY_CLOSE: BOOL NotifyEventHandler(es_message_t *pesMessage) { if (pesMessage->event_type == ES_EVENT_TYPE_NOTIFY_CLOSE && YES == pesMessage->event.close.modified) { __block es_message_t *pesTempMsg; pesTempMsg = es_copy_message(pesMessage); dispatch_async(gNotifyCloseQueue, ^{ // Performing Some processing on es_message_t if (pesTempMsg != NULL) { es_free_message(pesTempMsg); } }); if (pesMessage != NULL) { es_free_message(pesMessage); } } else { es_free_message(pesMessage); } return TRUE; } It would be helpful if someone help us to identify what could be wrong we are doing in above code and how to address/solve those problems (code snippet would be helpful) to avoid all possible crashes. ... Thanks & Regards, Mohamed Vasim
1
0
468
Jul ’24
Issues with LaunchAgent and LaunchDaemon
I have this application that is divided in 3 parts. A server that handles all the networking code A agent that handles all System related code A manager (NSApplication) to interact with the other two processes. Goals All three process should be kept alive if they crash All three processes must not restart if the user quits them though the NSApplication They need to run during the login window. My current set up using LaunchD is as follows. My Server process plist (relevant part) saved in System/LaunchDaemons key>MachServices</key> <dict> <key>com.myCompany.Agent.xpc</key> <true/> <key>com.myCompany.Manager.xpc</key> <true/> </dict> <key>ProgramArguments</key> <array> <string>PathToExecutable</string> <string>-service</string> </array> <key>RunAtLoad</key> <false/> My agent plist (saved in System/LaunchAgent) <key>QueueDirectories</key> <array> <string>PathToDirectory</string> </array> <key>RunAtLoad</key> <false/> <key>ProgramArguments</key> <array> <string>PathToExecutable</string> <string>service</string> </array> my Manager app plist (saved in System/LaunchAgent) <key>LimitLoadToSessionType</key> <string>Aqua</string> <key>RunAtLoad</key> <false/> <key>ProgramArguments</key> <array> <string>PathToExecutable</string> </array> <key>MachServices</key> <dict> <key>com.myCompany.Agent.manager.xpc</key> <true/> </dict> Currently I have another app that saves a file to the path of the QueueDirectories which triggers the launch of my Agent which then triggers the Server and Manager by starting a XPC Connection. QueueDirectories keeps the Agent alive (and hence all other processes) til file is removed and processes are quited through the manager. XPC Connections Server listens for a connection from agent and manager Manager listens for a connection from agent and starts a connection with server Agent starts a connection with Manager and Server Agent and Manager are owned by the user and server by root The problems When I start Agent by saving a file in the QueueDirectories path and connect to the Server over xpc I end up with two Agents, one owned by the user (the one I expect) and one owned by root. But if I manually start the Agent I do not have that problem. As I mentioned before, the server listens for a connection from the Agent. How do I stop getting two instances? or what is a better way to approach this?
3
0
384
Jul ’24
The certificate for this server is invalid. You might be connecting to a server that is pretending to be “subdomain.domainname.co.nz” which could put your confidential information at risk.
Hello All, We are facing weird issue rarely but it continues for few hours or a day. Observations: Issue get resolved automatically when we change iOS device network. We are using sub domain for all network request on iOS/Android App, only iOS Device is logging below mentioned issue. Both domain has different certificate, where we are using wildcard certificate on subdomain, (*.domain.co.nz ) Main domain don't have subdomain name in subject list (SAN or CN) we have verified both certificate are valid and supporting TLSv1.3 Also, We have verified instruction given by apple which is also looks good: https://support.apple.com/en-us/103769 you may observer *.wordpress.com is logged in certificate chain validation But We are not calling any of the network request on *.wordpress.com Our backend server is using only NodeJs and Express.js and as mentioned by out backend team, we don't have any use of main domain/server. Here is Xcode Error Log Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “subdomain.maindomain.co.nz” which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=( "<cert(0x11603ae00) s: *.wordpress.com i: Sectigo ECC Domain Validation Secure Server CA>", "<cert(0x11603b600) s: Sectigo ECC Domain Validation Secure Server CA i: USERTrust ECC Certification Authority>", "<cert(0x116043400) s: USERTrust ECC Certification Authority i: AAA Certificate Services>" ), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://subdomain.maindomain.co.nz/vider/api/v1/users/login, NSErrorFailingURLStringKey=https://subdomain.maindomain.co.nz/vider/api/v1/users/login, NSUnderlyingError=0x301ec2cd0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x3021b1360>, kCFNetworkCFStreamSSLErrorOriginalValue=-9843, kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9843, kCFStreamPropertySSLPeerCertificates=( "<cert(0x11603ae00) s: *.wordpress.com i: Sectigo ECC Domain Validation Secure Server CA>", "<cert(0x11603b600) s: Sectigo ECC Domain Validation Secure Server CA i: USERTrust ECC Certification Authority>", "<cert(0x116043400) s: USERTrust ECC Certification Authority i: AAA Certificate Services>" )}}, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask .<1>" ), kCFStreamErrorCodeKey=-9843, NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x3021b1360>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “subdomain.maindomain.co.nz” which could put your confidential information at risk.})) URLSessionTask failed with error: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “subdomain.maindomain.co.nz” which could put your confidential information at risk. "Show: Something went wrong! please try again after sometime!" "Networking error message: Optional("URLSessionTask failed with error: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “subdomain.maindomain.co.nz” which could put your confidential information at risk.") End of error Log, Kindly help us. Thanks in advance.
4
1
816
Jul ’24
Sonoma resets timestamps when renaming files on MSDOS/FAT filesystems
If you rename a file on a MSDOS/FAT filesystem on Sonoma, a few seconds later the OS updates the timestamp of the file to the current time. $ hdiutil create -size 64m -type SPARSE -fs "MS-DOS FAT32" -volname test1 -attach /tmp/test1.img /dev/disk3 FDisk_partition_scheme /dev/disk3s1 DOS_FAT_32 /Volumes/TEST1 created: /tmp/test1.img.sparseimage $ touch -t 01010000 /Volumes/TEST1/x $ sleep 5 $ ls -l /Volumes/TEST1/x -rwx------ 1 fred staff 0 Jan 1 2024 /Volumes/TEST1/x* $ mv /Volumes/TEST1/x /Volumes/TEST1/y $ ls -l /Volumes/TEST1/y -rwx------ 1 fred staff 0 Jan 1 2024 /Volumes/TEST1/y* $ sleep 5 $ ls -l /Volumes/TEST1/y -rwx------ 1 fred staff 0 Jul 17 05:57 /Volumes/TEST1/y* $ date Wed Jul 17 05:57:09 BST 2024 $ uname -a Darwin localhost 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64 Among the downstream effects of this is if you rsync -t files to a FAT filesystem, if you run the same command again a few seconds after, rsync will copy all the files again because the destination timestamps have not been preserved. This has been reported here: https://forums.developer.apple.com/forums/thread/741490 I was close to downgrading until I found I could use rsync -t --inplace to workaround this but I've not had this problem on Monterey or any prior MacOS release. This definitely seems like a regression in the core OS. Rename should preserve timestamps.
2
0
262
Jul ’24
Example Virtualization fails with Error Domain=VZErrorDomain Code=1
Hey im trying this example: https://developer.apple.com/documentation/virtualization/running_linux_in_a_virtual_machine And downloaded the vmlinuz and initrd.img from here https://download.fedoraproject.org/pub/fedora/linux/releases/40/Everything/aarch64/os/images/pxeboot but when trying to run i get this error: The output of: file vmlinuz is PE32+ executable (EFI application) Aarch64 (stripped to external PDB), for MS Windows I tried to uncompress with gunzip but this did not work if found this but this did not help eitehr https://developer.apple.com/forums/thread/709539
2
0
329
Jul ’24
ContentsOfDirectory for FileProvider URLs
I'm developing an iOS app. Through a .fileImporter I get access to a directory URL which might be provided by an external service like Dropbox (using a FileProvider). As the user picked the URL I have full access to it. I want to get the contents of the directory: FileManager.default.contentsOfDirectory( at: url, includingPropertiesForKeys: keys, options: [.skipsHiddenFiles] ) Unfortunately I only get whatever files the system is currently aware of, which in case of external providers is often not much. If the user opens the Apple Files app and navigates to the folder then the system gets the content from the external provider and back in my app contentsOfDirectory would show everything. What can I do to get a list of the URLs? Can I somehow trigger the system to update from the external provider? Or is there another way of handling this situation?
2
0
320
Jul ’24
the question of NFC
use NFC api has some error: 2024-07-15 15:42:59.633782+0800 TestNFC[16022:1038141] tagReaderSessionDidBecomeActive 2024-07-15 15:43:03.608427+0800 TestNFC[16022:1038141] [xpc.exceptions] <NSXPCConnection: 0x282ba90e0> connection to service with pid 58 named com.apple.nfcd.service.corenfc: Exception caught during decoding of received selector didDetectExternalReaderWithNotification:, dropping incoming message. Exception: Exception while decoding argument 0 (#2 of invocation): Exception: decodeObjectForKey: class "NFFieldNotification" not loaded or does not exist how can I fix it ? thanks
0
0
166
Jul ’24
mount(2) always returning errno 63 (File name too long) when mounting NFS share
I've been trying use the mount(2) function to programmatically mount an NFS share on my application, although I seem to be having issues with the function signature and the parameters that I'm supposed to be passing. According to the man pages this is the function's signature: int mount(const char *type, const char *dir, int flags, void *data); As the documentation is vague on the value of type, I've assumed that it was the network location, in the form of server.name:/some/location. So I've written the following test code: #include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;errno.h&gt; #include &lt;sys/param.h&gt; #include &lt;sys/mount.h&gt; int main(int argc, char **argv) { const char *type = "nfsserver.lan:/some/path"; const char *mntp = "/Users/localuser/tmpmount"; int ret = mount(type, mntp, 0, NULL); printf("ret = %d\n", ret); printf("errno = %d (%s)\n", errno, strerror(errno)); return 0; } Upon running this program on my Mac Pro running macOS 12.7.4 I got the following output: ret = -1 errno = 63 (File name too long) The NFS share location string I'm actually using is exactly 46 characters long and I am able to mount the share using the mount(8) command. I'm also able to use the unmount(2) function for testing after I've used the mount(8) command. What am I missing and how can I fix this issue? I think I'm probably passing the parameters in the wrong way, but sadly the documentation is quite vague.
2
0
345
Jul ’24
Issues with NSBundle failed, VTParavirtualization, IOServiceMatchingFailed, AppleM2ScalerParavirtDriver
I'm building an app in Apple Virtualization but I can no longer generate images after updating to macOS Sequoia. It's a simple function that will create thumbnails in either HEIF or JPEG, but neither work now. I get these warnings every time: CGImageProviderGetContentHeadroom: Bad headroom value 0.000000 for SDR, returning 1.0 NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed IOServiceMatchingfailed for: AppleM2ScalerParavirtDriver <<<< VTParavirtualization >>>> VTParavirtualizationReplyClerkWaitForReply signalled err=-19092 (kVTParavirtualizationTimeoutErr) (timeout waiting for pending reply) at VTParavirtualization. c: 3804 writeImageAtIndex:1077: *** CMPhotoCompressionSessionAddImage: err = unknown error [-19092] (codec: 'hvc1') The operation couldn't be completed. (CINonLocalizedDescriptionKey error 3.) Will this be resolved in Xcode 16 or macOS Sequoia?
3
2
1.6k
Jul ’24
Possibilities of HCE with new EEU regulations
We want to use HCE or Wallet to use the iPhone on NFC readers that start EV chargers. They use the same tech as transit systems (MiFare and ISO 14443-4), but the backend systems only use the NFC UID for verification. Is it possible to use HCE (CardSession) or Wallet (Transit card) to transmit a static UID? If so, could our use-case go under either In-store purchase, loyalty programme, or transit? Or are those categories very rigid as to their use case? The new EEU regulation seems to open up this a bit.
2
0
524
Jul ’24
Query Regarding Background Bluetooth Notification Handling in iOS
Hi, I am currently working on a mobile application for iOS that involves communication with a Bluetooth peripheral device, specifically a smart analog watch. I have some questions regarding the feasibility of certain aspects of the architecture and would appreciate your guidance. Project Overview: Functionality: The application connects to a Bluetooth peripheral (the analog smartwatch) and utilizes the Apple Notification Center Service (ANCS) to broadcast notifications to the peripheral. Notification Flow: When a notification arrives on the iPhone, and if the peripheral is connected via Bluetooth, ANCS broadcasts the notification to the peripheral. The peripheral sends the notification back to the mobile application via Bluetooth. The mobile application then sends a request to a server, which uses AI to determine if the notification needs to be displayed on the watch. If the server validates the notification, the mobile app triggers a vibration on the watch to indicate the notification. Current Status: I can receive notifications from my watch to the mobile application via Bluetooth when the app is in the foreground. Questions: I need this notification handling to work in the background or killed mode. My ideal solution involves a background service that, upon receiving a notification from the mobile app, sends a request to the server and, based on the server's response, sends a valid notification back to the watch via Bluetooth. Is it possible to implement such functionality in iOS? Specifically: Can an iOS application receive and handle Bluetooth notifications in the background or when the app is terminated? What are the best practices or recommended approaches for maintaining Bluetooth communication in background or killed mode? Are there any specific APIs or frameworks that can facilitate this kind of background operation? Thanks
1
0
332
Jul ’24
CoreBluetooth Advertising and Scanning Issue in iOS 18/iPadOS 18 Beta 3
Hello, Has anyone encountered issues with CoreBluetooth advertising and scanning between iOS 18/iPadOS 18 Beta 3 ? I'm want to know this is a bug or an intended change in behavior. Issue Summary: Central device on iOS 18/iPadOS 18 Beta 3 (foreground) and Peripheral device on iOS 17.5.1 (background) fail to communicate via BLE advertising. The reverse setup or using non-iOS 18 devices works as expected. Detailed Description: I am developing an iOS/iPadOS application using CoreBluetooth for advertising and scanning. Here are the specifics of my setup: The application uses a fixed BLE service UUID, and scanning is performed with the specified service UUID. Background Modes Uses Bluetooth LE accessories and Acts as a Bluetooth LE accessory are enabled to allow advertising and scanning even when the app is in the background. When the Central device is running iOS 18/iPadOS 18 Beta 3 and the app is in the foreground scanning, and the Peripheral device is running iOS 17.5.1 with the app in the background advertising, the Central device cannot receive the advertisements from the Peripheral device. ( CBCentralManagerDelegate.centralManager(_:didDiscover:advertisementData:rssi:) don't work.) In the reverse scenario (Central on iOS 17.5.1 in the foreground scanning, and Peripheral on iOS 18/iPadOS 18 Beta 3 in the background advertising), the advertisements are received correctly. Additionally, advertisements are received correctly in cases where both devices are not on iOS 18/iPadOS 18. I am wondering if anyone else has encountered this issue or if there is any information available regarding whether this is a bug or an intended behavior change in iOS 18/iPadOS 18. Thank you.
5
3
802
Jul ’24
Connect a Mac and a Watch via Core Bluetooth
Hello! I currently have a pair of apps that can connect a Mac and an iPhone and communicate to each other. I've been trying to do the same between a Mac and a Watch. In my current implementation, the Mac is the central and the iPhone is a peripheral. But according to some internet search, it seems that Watch can only be the central. Is this true, and still the case now, please? If so, can I use the Watch as the central and the Mac as a peripheral? Thank you!
1
0
271
Jul ’24
Vision Pro OS file location
I would like to know what is the global path of the Vision Pro file system. For instance, if I put a file called example.pdf inside "On My Apple Vision Pro" what would be the global path for that file? "On My Apple Vision Pro/user_name/example.pdf" or "/example.pdf" or "/username/example.pdf" and so on. I tried to search about it but I didn't found no official source about it. Thanks in advance!
1
0
466
Jul ’24