Post

Replies

Boosts

Views

Activity

Have I encountered a common problem with App clip?
My app contains app clips and it is already available in the app store. After setting up Advanced App Clip Experiences, it has not been able to take effect. I cannot wake up the App clips through the NFC tag containing the link. My Advanced App Clip Experiences status are always "Received". I checked everything I could and didn't find any issues, I also saw a lot of people on the developer forums having the same problem but didn't see a solution. Setting->Developer->APP CLIPS TESTING (section)->Diagnostics-> filed my URL, result show below. I can open my App clips by Default App Clip Experiences from Smart App Banner on my website. Do I need to re-upload a new version for App Review, or do I just have to wait? is there a solution?
6
1
827
Sep ’24
Writing ndef messages to a NXP 215 tag with known password
I am using the CoreNFC framework in iOS 14 above to read and write to a NXP 215 NFC tag. I have no problems reading the tag and getting the data out from it, but I have a problem when trying to write to it when password protection is enabled in the tag. as you can see the class NFCTagManager. I use the NFCTagReaderSession to read the tag. Then I use a switch statement on the tag to get the type of it, where I get .miFare. After connect the session to the tag. I am trying "authenticateAndWrite" according to the manual of NTAG21X . I try to unlock it using the tag.sendMiFareCommand with the a UInt8 array starting with the “0x1B” auth command byte followed by the 4 bytes password. Then I check the response data and compare it to the PACK which is programmed into the tag, which matches. Then I call the mifareTag.queryNDEFStatus function to make sure, that the tag is having the status .readWrite. Finally I call the mifareTag.writeNDEF function with an NDEF Message which is an exact copy of the one already on the tag. From this call I got the error: “Stack Error” . If I follow the approach above with a similar tag when i using NXP TagWriter app clear the password, the write is successful using the same code.(My guess is that after clearing the tag's password, the card's password will not actually be cleared, but the write restrictions on certain sectors will be lifted.) Questions: What are the correct approach in your opinion to unlocking a tag with a password using the CoreNFC framework. Is there a function in CoreNFC to unlock a password protected tag, or is sendMiFareCommand the right way to do it? Why do I get a "Stack Error" when I verify the password and prepare to write the NDEF data? class NFCTagManager: NSObject, NFCTagReaderSessionDelegate { var readerSession: NFCTagReaderSession? var writeData: WriteData? var ndefMessage: NFCNDEFMessage? func writeTag(writeData: WriteData) { guard NFCNDEFReaderSession.readingAvailable else { NSLog("NFC is not available.") return } self.writeData = writeData readerSession = NFCTagReaderSession(pollingOption: .iso14443, delegate: self) readerSession?.alertMessage = "Hold your iPhone near a writable NFC tag to update.".localizeString() readerSession?.begin() } func writeNDEF(mifareTag: NFCMiFareTag) { mifareTag.queryNDEFStatus { (status, capacity, error) inif status == .readWrite { mifareTag.writeNDEF(self.ndefMessage!) { (error: Error?) inif let error = error { let msg = String(format: NSLocalizedString("Failed to write NDEF", comment: "写入NDEF失败"), error.localizedDescription) self.readerSession?.invalidate(errorMessage: msg) } else { self.readerSession?.alertMessage = "Update success!".localizeString() self.readerSession?.invalidate() } } } else if status == .readOnly{ //error } else { //error } } } func authenticateAndWrite(mifareTag: NFCMiFareTag) { let password: [UInt8] = [0xFF, 0xFF, 0xFF, 0xFF] // Replace with the correct passwordlet pack: [UInt8] = [0x00, 0x00] // Replace with the correct PACK // Prepare the password commandlet passwordCommand: [UInt8] = [0x1B] + password // Authenticate with the tag mifareTag.sendMiFareCommand(commandPacket: Data(passwordCommand)) { (response: Data, error: Error?) inif let error = error { let msg = String(format: NSLocalizedString("Authentication failed", comment: "身份验证失败失败"), error.localizedDescription) self.readerSession?.invalidate(errorMessage: msg) return } // Check the PACK response to verify correct authentication if response.count == 2 && Array(response) == pack { // Successfully authenticated, now write NDEF self.writeNDEF(mifareTag: mifareTag) } else { //error } } } func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) { //Prepare data ndefMessage = NFCNDEFMessage(records: [urlPayload!]) os_log("MessageSize=%d", ndefMessage!.length) } func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) { NSLog("didInvalidateWithError : \(error.localizedDescription)") } func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) { if tags.count > 1 { session.alertMessage = "More than 1 tags found. Please present only 1 tag.".localizeString() session.restartPolling() return } guard let tag = tags.first else { //error return } session.connect(to: tag) { (error: Error?) inif let error = error { let msg = String(format: NSLocalizedString("Connection failed", comment: "连接失败"), error.localizedDescription) session.invalidate(errorMessage: msg) return } //switch to mifareTagif case let .miFare(mifareTag) = tag { self.authenticateAndWrite(mifareTag: mifareTag) } else { //error } } } }
0
0
321
Sep ’24