According to Technical Note TN2083 the Window Server advertises itself in the global bootstrap namespace, which is why you can launch GUI applications from SSH sessions, even if sshd/sshd-keygen-wrapper is launched as a launch daemon (in a non-GUI per-session bootstrap namespace).
As I understand it this is also why SessionGetInfo() reports NO for sessionHasGraphicAccess, as the SSH session is not an Aqua session type, while CGSessionCopyCurrentDictionary() does return a valid dict, because in practice you have access to the window server.
However, the tech note advices against running GUI programs from SSH sessions, as other GUI services may not be exposed to the global or non-GUI per-session bootstrap namespace. It uses com.apple.dock.server as an example of such a service, showing how Activity Monitor has different behavior when launched via SSH than via the UI.
Based on the advice of the tech note, articles like https://aahlenst.dev/blog/accessing-the-macos-gui-in-automation-contexts/ recommends running CI UI tests via a Launch Agent instead of SSH.
Now, I've tried to reproduce the the Activity Monitor case on macOS 12 and macOS 15, and I can not reproduce the missing Dock features. The Testing with Xcode documentation also says that:
By default, when you use ssh to login to an macOS system that has no active user session running, a command-line session is created. To ensure that an Aqua session is created for an ssh login, you must have a user logged in on the remote macOS host system. The existence of a user running on the remote system forces Aqua session for the ssh login. Once there is a user running on the host system, running xcodebuild from an ssh login works for all types of tests.
Which begs the question: Does modern macOS versions expose GUI services to the global or non-GUI per-session bootstrap namespace, or otherwise enable UI testing from SSH sessions, so that UI tests can safely be run from SSH sessions (as long as the user is logged in to the remote system's UI). Has things changed in this regard?
Core OS
RSS for tagExplore the core architecture of the operating system, including the kernel, memory management, and process scheduling.
Post
Replies
Boosts
Views
Activity
I'm observing all sorts of race conditions occurring in various VNOPs my custom filesystem implements.
I'm inclined to attribute this to my implementation not following the locking rules expected by the system of a 3rd party filesystem as well as it should.
I've looked at how locking is done in Apple's own implementation of Samba and NFS clients.
The Samba client uses read/write locks to protect its node from data races.
While the NFS client uses mutex locks for the same purpose.
I realised that I don't have a clear model in my head of how locking should be done properly.
Thus my question, what are the locking rules for VFS and VNOP operations?
Thanks.
We have a push-to-talk client, Part of Push APNS, app never received the BG task expiry.
The app is suspended.
Received Push-To-Talk APNS
Here requested a BGTask and it got successfully registered
Since it is a PTT call path, it ended immediately(via code) due to internal restrictions Ex: DND mode for client specific. The client allowed BG time more than 30 seconds and looks client has been suspended but Never received a BG task expiration handler from OS
In sys diagnose logs confirmed, BGTask registered successfully
2024-09-03 16:18:47.331890 +0530 default AT&T EPTT : Created background task .
But never got fired expiration handler.
Feedback - FB15145380
Hello,
I am developing an application that involves writing data to RFID tags using NFC (ISO/IEC 14443A/B, Mifare, and FeliCa standards) for an electric vehicle charging station. However, I am consistently facing an issue where the Apple Wallet app is automatically triggered during NFC operations on iOS. This problem occurs every time I attempt to write data to the RFID tags, preventing the application from properly detecting or interacting with the NFC tags.
Here are the key details of the issue:
Device: iPhone (tested on various models and iOS versions)
Issue: Apple Wallet automatically opens during NFC tag writing operations.
Expected Behavior: My application should write data to RFID tags without triggering Apple Wallet.
RFID Standards: ISO/IEC 14443A/B, Mifare, FeliCa.
Code Implementation: I am using the Core NFC framework and NFCISO14443ReaderSession to communicate with the RFID tags. The same code works seamlessly with Android devices, but iOS continuously triggers the Wallet app.
Here’s a brief code snippet that demonstrates the problem:
import CoreNFC
func startNFCSession() {
let session = NFCISO14443ReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: false)
session?.alertMessage = "Hold your iPhone near the NFC tag."
session?.begin()
}
func readerSession(_ session: NFCISO14443ReaderSession, didDetect tags: [NFCISO14443Tag]) {
guard let tag = tags.first else { return }
session.connect(to: tag) { (error: Error?) in
if let error = error {
session.invalidate(errorMessage: "Connection failed: \(error.localizedDescription)")
return
}
// Write data to the tag here
// The Wallet app opens instead of allowing data writing.
}
}
I've taken steps to ensure that I am not using NDEF tags, as I understand that may interfere with the Wallet functionality. Despite using the lower-level NFCISO14443ReaderSession API, the issue persists.
I’ve also tried disabling all Wallet settings on the device, but the problem still occurs. Additionally, no such issues are experienced on Android devices with similar functionality, so it appears to be an iOS-specific problem.
Is there a way to prevent Apple Wallet from being triggered when using Core NFC to interact with RFID tags?
Any assistance or guidance on how to solve this issue would be greatly appreciated, as this is a critical feature for the functionality of the electric vehicle charging station system we are building.
Thank you in advance!
Any help?
Translated Report (Full Report Below)
Process: PokerStars [2219]
Path: /Applications/PokerStars.app/Contents/MacOS/PokerStars
Identifier: com.pokerstars.PokerStars
Version: 70.813 (70.813)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2024-09-30 11:40:02.5034 +0200
OS Version: macOS 15.0 (24A335)
Report Version: 12
Bridge OS Version: 9.0 (22P353)
Anonymous UUID: 4748D711-22F5-94D6-9366-54F5DEB78692
Time Awake Since Boot: 2800 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000017f7cb461
Exception Codes: 0x0000000000000001, 0x000000017f7cb461
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [2219]
VM Region Info: 0x17f7cb461 is not in any region. Bytes after previous region: 1385022562 Bytes before following region: 105546682420127
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
CG raster data 12c800000-12ceef000 [ 7100K] r--/r-- SM=COW
---> GAP OF 0x5ffed3111000 BYTES
MALLOC_NANO 600000000000-600020000000 [512.0M] rw-/rwx SM=PRV
iOS now has a pre-build closure optimization for launch, so how do I know if my app launches with a pre-build closure optimization?
In what way can I check that my application has a pre-built closure at startup?
I'm the developer of Camera RawX (avail on the Mac App Store).
I'm working on Camera RawX for iOS to provide Quick Look support for camera RAW files not supported by iOS.
I use the Files app to open a RAW file to invoke Quick Look on my iPad (it is running iOS 17.6.1).
The RAW file in question is a Fuji compressed RAF file.
When I tap on the RAF file, iOS opens the Quick Look window, but my app's Quick Look extension is not called.
If the RAW file in question is a Sigma Foveon X3F file, a file that has no native Apple RAW support, then my Quick Look extension is called and I'm able to display the image in the Quick Look window without issue.
It seems that a system recognized RAW file extension (RAF in this case), is not triggering my Quick Look extension. On the macOS, this works fine without any issue.
The strange thing is that my Thumbnail extension is being called when the RAW files show up in Files. Even if it is a RAF file. So it seems like a bug to me or am I missing something crucial in my Info.plist file?
Albert
When recursively removing a directory with a large number of entries that resides on my custom filesystem, rm(1) aborts with ENOENT.
% rm -Rv /Volumes/myfs/linux-kernel/linux-6.10.6
[...]
/Volumes/myfs/linux-kernel/linux-6.10.6/include/drm/bridge/aux-bridge.h
/Volumes/myfs/linux-kernel/linux-6.10.6/include/drm/bridge/dw_hdmi.h
rm: fts_read: No such file or directory
I'm observing the following sequence of calls being made.
2024-09-17 17:58:25 vnops.c:281 myfs_vnop_lookup: rm-936 -> dw_hdmi.h ;initial lookup call
2024-09-17 17:58:25 vnops.c:315 myfs_vnop_lookup: -> cache_lookup(dw_hdmi.h)
2024-09-17 17:58:25 vnops.c:317 myfs_vnop_lookup: <- cache_lookup(dw_hdmi.h) -> 0 ;cache miss
2024-09-17 17:58:25 rpc.c:431 myfsLookup: rm-936 -> dw_hdmi.h ;do remote lookup
2024-09-17 17:58:25 rpc.c:500 myfsLookup: -> myfs_lookup_rpc(dw_hdmi.h)
2024-09-17 17:58:25 rpc.c:502 myfsLookup: <- myfs_lookup_rpc(dw_hdmi.h) -> 0 ;file found and added to vfs cache
2024-09-17 17:58:25 vnops.c:281 myfs_vnop_lookup: rm-936 -> dw_hdmi.h ;subsequent lookup call
2024-09-17 17:58:25 vnops.c:315 myfs_vnop_lookup: -> cache_lookup(dw_hdmi.h)
2024-09-17 17:58:25 vnops.c:317 myfs_vnop_lookup: <- cache_lookup(dw_hdmi.h) -> -1 ;cache hit
2024-09-17 17:58:25 vnops.c:1478 myfs_vnop_remove: -> myfs_unlink(dw_hdmi.h) ;unlink sequence
2024-09-17 17:58:25 rpc.c:1992 myfs_unlink: -> myfs_unlink_rpc(dw_hdmi.h)
2024-09-17 17:58:25 rpc.c:1994 myfs_unlink: <- myfs_unlink_rpc(dw_hdmi.h) -> 0 ;remote unlink succeeded
2024-09-17 17:58:25 vnops.c:1480 myfs_vnop_remove: <- myfs_unlink(dw_hdmi.h) -> 0
2024-09-17 17:58:25 vnops.c:1487 myfs_vnop_remove: -> cache_purge(dw_hdmi.h)
2024-09-17 17:58:25 vnops.c:1489 myfs_vnop_remove: <- cache_purge(dw_hdmi.h)
2024-09-17 17:58:25 vnops.c:1499 myfs_vnop_remove: -> vnode_recycle(dw_hdmi.h)
2024-09-17 17:58:25 vnops.c:1501 myfs_vnop_remove: <- vnode_recycle(dw_hdmi.h)
2024-09-17 17:58:27 vnops.c:281 myfs_vnop_lookup: fseventsd-101 -> dw_hdmi.h ;another lookup; why?
2024-09-17 17:58:27 vnops.c:315 myfs_vnop_lookup: -> cache_lookup(dw_hdmi.h)
2024-09-17 17:58:27 vnops.c:317 myfs_vnop_lookup: <- cache_lookup(dw_hdmi.h) -> 0
2024-09-17 17:58:27 rpc.c:431 myfsLookup: fseventsd-101 -> dw_hdmi.h
2024-09-17 17:58:27 rpc.c:500 myfsLookup: -> myfs_lookup_rpc(dw_hdmi.h)
2024-09-17 17:58:27 rpc.c:502 myfsLookup: <- myfs_lookup_rpc(dw_hdmi.h) -> ENOENT(2)
2024-09-17 17:58:27 vnops.c:371 myfs_vnop_lookup: SET(NNEGNCENTRIES): dw_hdmi.h
2024-09-17 17:58:27 vnops.c:373 myfs_vnop_lookup: ENOENT(2) <- shouldAddToNegativeNameCache(dw_hdmi.h)
I checked the value of vnode's v_iocount when vnop_remove and vnop_reclaim are being called.
Each vnop_remove and followed by vnop_reclaim with v_iocount set to 1 in both calls, as expected.
What I don't understand is why after removing the file is there another lookup call being made, which returns ENOENT to rm(1), which causes it to abort.
Any pointers on what could be amiss there would be much appreciated.
We have a sync solution with two apps that are an application-group. I use an NSUserDefaults object opened with initWithSuiteName to share config data between the two. That has not been a problem in the past. However,in the Sequoia Beta 7 (24a5327a), when I read or write to the NSUserDefaults from either app, the " would like to access data from other apps" dialog appears. This occurs on every restart on our test systems and more often for some of our customers testing (perhaps with older betas).
The warning is not indicative of what I'm doing, and the fact that it comes up every single launch will freak out customers.
There was a similar issue opened in Beta 4 that was marked fixed in beta 5: https://developer.apple.com/forums/thread/760072?answerId=799001022#799001022
I posted this in the beta feedback forums before GA but got no response.
I am trying to open external/mounted storage in Finder. I simply just want to show the root directory. I have tried multiple things, none worked.
NSWorkspace.shared.open()
Does work when opening the user's disk (e.g. Macintosh HD), but when comes to any of the external storages a warning appears: "The application "ABC" does not have permission to open "Folder Name".
Now, the app ha been granted all permissions in the preferences (Full Disk Access + Files and Folders). Furthermore, I don't even need or care of accessing this directory from within my app. I want the Finder to open it.
I am using com.apple.security.files.user-selected.read-only and testing on MacOS: 14.6.1
Device name: iPhone 15 Pro Max
Purchase date: January this year
Usage: The following problems never occurred before upgrading to iOS18.1 beta4 and 5
Current system version: iOS 18.1 beta 5 (22B5054e)
Current status: System stuck, unable to operate, abnormal heating, battery capacity reduced by 1% after upgrading to beta5
Detailed description: My phone has been in normal use since purchase, and I have never downloaded or installed cracking tools or files from unknown sources. I concluded that the problem was caused by upgrading the beta version of the ios system. During a period of time when using ios18 beta 4, the phone suddenly became inoperable, the screen failed intermittently, and the failure time became longer and longer. Specifically, the app cannot be operated, and there is no response to sliding up and down, left and right, clicking, touching, and long pressing (almost all APPs, not an exception). In recent days, I found that this phenomenon of the phone seems to be related to charging. Every time it is fully charged, it will not be able to operate when the device is turned on. The iPad and iPhone have the same reaction. During the period when the device is unresponsive, iCloud cannot be synchronized normally, the phone heats up, the software crashes, white dots appear on the edge of the screen (just like a bad pixel on the screen), the video cannot be loaded, and a series of problems.
Supplement: Which version can solve these problems? How to return to the official version without flashing? Can I receive version push normally by turning off the beta test switch?
Feeling: Since I did not make a full backup of the lower version, I hope that iOS18.1beta5 will solve the problem. Unfortunately, it is still not solved in beta5, and the problem is getting worse. My phone is now a brick and cannot be used normally. This accident is the first time I have encountered such a serious problem since I used Apple devices. I am very disappointed. I hope Apple engineers can fix it as soon as possible.
In our onboarding sequence we inform the user that Siri is required and to set it up if they have it off. We have a link that takes us to the root of the Systems tree, but have been unable to get it to launch into the Siri prefs itself, using a scheme that's widely available on StackOverflow, GitHub and so on.
ChatGPT says it can't be done as of 2022. I see a list on GitHub of the domains that was last updated just a year ago, suggesting that at least as of 17 it "should" work.
Another place said Apple would bounce apps which attempt to do that (we have the recommended URL string already in there which should have been detectable by their scans, and have not been bounced due to that so far).
Hi,Regarding FileProvider, I know it has a permission authorization pop-up to control whether to open the FileProvider extension in the application settings
But when I first used it, the switch was turned off by default. I noticed that some applications can pop up an authorization pop-up to prompt the user to turn on this permission
I would like to ask what API this authorization pop-up is displayed through
I expect the authorization pop-up window to pop up as shown in the following picture
Thanks
Hi there,
I have two extension in my App, a Finder Sync and a Share Extension. Because these are disabled by default and automatically enabling them is, according to my extensive research, not possible, I want to provide an easy way for the user to enable the extensions when the app is opened. I am currently displaying a popup, with a button to open the preferences.
I have struggled with this a bit, by now I managed to open the main preferences window using
NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference")!)
which is rather suboptimal though, since the user has to select the extensions option manually and isn't directly redirected there.
What I have also found is that the menu of the FinderSyncExtension can be opened directly by using FIFinderSyncController.showExtensionManagementInterface()
which is unfortunately suboptimal as well, because it only shows the managment interface of the finder extension and not the overview of all extensions.
Is there any way to either enable the extensions programatically, or if not, is there a way to show the "Added Extensions" portion of the Extensions menu in the system preferences?
I'm having a problem launching an iOS app。Appeared on individual iOS 18 and iPhone 16。
The real-time log displays the following errors:
Sep 26 18:51:58 hetieweideiPhone SpringBoard(FrontBoard)[3869] : Bootstrapping failed for <FBApplicationProcess: 0x7c898ad00; app<cn.com.***>:> with error: <NSError: 0x303c0e6d0; domain: RBSRequestErrorDomain; code: 5; "Launch failed."> {
NSUnderlyingError = <NSError: 0x303c0d590; domain: NSPOSIXErrorDomain; code: 85> {
NSLocalizedDescription = Launchd job spawn failed;
};
}
20240926_185203_474_iPhone.log
It crashes any app including System Preferences or etc.
Below is an example of crash log with my own app.
2024-09-26_15-05-07.3244_+0800-b0897577a4d8c61bb9452bf8ae1f2a0ca097aabc.crash
Last Exception Backtrace:
0 CoreFoundation 0x19fa6508c __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x19cd672e4 objc_exception_throw + 88 (objc-exception.mm:356)
2 CoreFoundation 0x19fa29140 -[__NSArrayM objectAtIndexedSubscript:] + 592 (NSArrayM.m:309)
3 UIKitCore 0x1a2fb6554 -[UIInputSwitcherView localizedTitleForItemAtIndex:] + 32 (UIInputSwitcherView.m:860)
4 UIKitCore 0x1a2fbda68 -[UIKeyboardMenuView customizeCell:forItemAtIndex:] + 384 (UIKeyboardMenuView.m:1392)
5 UIKitCore 0x1a2fb68ac -[UIInputSwitcherView customizeCell:forItemAtIndex:] + 88 (UIInputSwitcherView.m:914)
6 UIKitCore 0x1a2fb681c -[UIInputSwitcherView tableView:cellForRowAtIndexPath:] + 192 (UIInputSwitcherView.m:907)
I'm trying to follow the guide for creating a virtual device here. My goal was to see the set report print the data (and to eventually create a virtual gamepad and dispatch input reports of button presses).
I am on MacOS v15.0 and I have CoreHID.framework linked (not embedded). However, when using the sample code below, HIDVirtualDevice returns nil.
import Foundation
import CoreHID
// This describes a keyboard device according to the Human Interface Devices standard.
let keyboardDescriptor: Data = Data([0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, 0x05, 0x07, 0x19, 0xE0, 0x29, 0xE7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x05, 0x95, 0x05, 0x75, 0x01, 0x91, 0x02, 0x95, 0x01, 0x75, 0x03, 0x91, 0x01, 0x05, 0x07, 0x19, 0x00, 0x2A, 0xFF, 0x00, 0x95, 0x05, 0x75, 0x08, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x81, 0x00, 0x05, 0xFF, 0x09, 0x03, 0x75, 0x08, 0x95, 0x01, 0x81, 0x02, 0xC0])
let properties = HIDVirtualDevice.Properties(descriptor: keyboardDescriptor, vendorID: 1)
let device = HIDVirtualDevice(properties: properties)
final class Delegate : HIDVirtualDeviceDelegate {
// A handler for system requests to send data to the device.
func hidVirtualDevice(_ device: HIDVirtualDevice, receivedSetReportRequestOfType type: HIDReportType, id: HIDReportID?, data: Data) throws {
print("Device received a set report request for report type:\(type) id:\(String(describing: id)) with data:[\(data.map { String(format: "%02x", $0) }.joined(separator: " "))]")
}
// A handler for system requests to query data from the device.
func hidVirtualDevice(_ device: HIDVirtualDevice, receivedGetReportRequestOfType type: HIDReportType, id: HIDReportID?, maxSize: size_t) throws -> Data {
print("Device received a get report request for report type:\(type) id:\(String(describing: id))")
assert(maxSize >= 4)
return (Data([1, 2, 3, 4]))
}
}
if (device != nil) {
print("Device is ready")
await device?.activate(delegate: Delegate())
try await device?.dispatchInputReport(data: Data([5, 6, 7, 8]), timestamp: SuspendingClock.now)
} else {
print("Device not created")
}
I have a program that creates a TCP server socket and listens on it.
When the program accepts a connection from a client, it calls poll(2) repeatedly to see if there is any input available, like this:
for (int i = 0; i < 1000000; i++) {
struct pollfd fds[] = {{ .fd = clientfd, .events = POLLIN, .revents = 0 }};
int r = poll(fds, 1, 0);
if (r < 0) {
perror("poll");
exit(1);
}
}
On my Intel iMac, this takes about 15 seconds. If I use select(2) instead, as follows, it takes about 550ms.
for (int i = 0; i < 1000000; i++) {
struct timeval timeout = { .tv_sec = 0, .tv_usec = 0 };
fd_set infds;
FD_ZERO(&infds);
FD_SET(clientfd, &infds);
int r = select(1, &infds, 0, 0, &timeout);
if (r < 0) {
perror("select");
exit(1);
}
}
https://gist.github.com/xrme/cd42d3d753ac00861e439e012366f2cf is a C source file that contains a complete example.
If you're inclined to take a look, please download the file from the gist and do cc poll-test.c and then ./a.out. Connect to it with nc 127.0.0.1 6444 and observe that it will take quite a while. (Activity Monitor will show a large number of "idle wake ups", but I'm not clear what that signifies.)
Recompile with cc -DUSE_SELECT, run ./a.out and connect again, and it will complete in under a second.
Advisability of this usage aside (which is adapted from a much larger system), is there anything here to be done to make poll faster? Other systems I have looked at (FreeBSD, OmniOS, Linux) do not exhibit the same slowdown with poll.
I am trying to fetch DHCP server identifiers of the current network. For IPv4 I am able to get this information using SCDynamicStoreCopyDHCPInfo and then using DHCPInfoGetOptionData fetching option 54.
I am trying to do the same thing for IPv6, in my scutil I do see DHCPv6 present. Is there any API present which fetches this information for v6 DHCP servers, or do I have to get this direct from scutil?
We have a financial application where we want to use NFC to broadcast a Payment URL to another iPhone or Android device when initiating a payment transaction. This will then open the banking application installed on the recipient’s device, allowing the transaction to be completed.
We have already made the necessary requests to Apple and configured the entitlements file as follows:
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.nfc.hce</key>
<true/>
<key>com.apple.developer.nfc.hce.iso7816.select-identifier-prefixes</key>
<array>
<string>D2760000850101</string>
</array>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
<string>NDEF</string>
</array>
</dict>
I've tried to use CardSession with the sample code provided by Apple on their site: Card Session
The connection between the devices (two iPhones, OS is above iOS 17.4) is established, the event stream's case .received(let cardAPDU): works, however, when I send the response, nothing really happens
Initial APDU response:
CLA | 0x00
INS | 0xA4
P1 | 0x04
P2 | 0x00
DATA | 0x7D2760000850101 (guess this is the AID)
Le | 00
Sending the apdu response in the event stream via:
do {
guard let request = APDUUtil.createAPDURequest(from: paymentUrl) else { return }
try await cardAPDU.respond(response: request)
await cardSession.stopEmulation(status: .success)
}
static func createAPDURequest(from paymentUrl: URL?) -> Data? {
guard let paymentUrl else { return nil }
let ndefMessage = APDUUtil.createNDEFMessage(from: paymentUrl)
APDUUtil.updateNdefRecordFile(ndefMessage: ndefMessage)
let data = Data(mNdefRecordFile)
let apdu = NFCISO7816APDU(instructionClass: 0x00,
instructionCode: 0xA4,
p1Parameter: 0x04,
p2Parameter: 0x00,
data: data,
expectedResponseLength: -1) // Tried with different values
return apdu.data
}
static func createNDEFMessage(from url: URL?) -> NFCNDEFMessage? {
guard let url,
let payload = NFCNDEFPayload.wellKnownTypeURIPayload(url: url) else {
return nil
}
return NFCNDEFMessage(records: [payload])
}
static func updateNdefRecordFile(ndefMessage: NFCNDEFMessage?) {
guard let ndefMessage else {
return
}
// Convert the NFCNDEFMessage to Data
let ndefMessageData = ndefMessage.records.reduce(Data()) { result, record -> Data in
var result = result
result.append(record.payload)
return result
}
let nlen = ndefMessageData.count
mNdefRecordFile = [UInt8](repeating: 0, count: nlen + 2)
// Store the length in the first two bytes (big-endian format)
mNdefRecordFile[0] = UInt8((nlen & 0xFF00) >> 8)
mNdefRecordFile[1] = UInt8(nlen & 0xFF)
// Copy the NDEF message data into the data starting at index 2
mNdefRecordFile.replaceSubrange(2..<mNdefRecordFile.count, with: ndefMessageData)
}
Could someone please help?
I also tried to send the payment url as Data made from url.
We have a working Android application, which uses HCE too (they use NDEF message and byte arrays in communication).
As I've seen, the NFCNDEFReaderSessionDelegate and NFCTagReaderSessionDelegate is not suitable for communication between two iOS devices...