cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot Detect ST25DVC Tag in iOS

Aly
Associate II

Hello All,

 

I am facing a problem with NFC reading with ST25DV64KC-DISCO board.

To integrate the SDK, I have followed the instruction over here

 

Even though I have imported all of the SDK files, and supporting files as well (including models, protocols and utilities).

But this same code detects the tag in original project, but in my project it fails to type cast to original form.

In specific, I get problem with following code in from "ST25DVMailboxManagementViewController"

Screenshot 2024-11-08 at 09.34.38.png

The following condition fails in my code, but succeeds in iOS NFCTap App.

 

 

if (!(st25SDKTag is ST25DVTag || st25SDKTag is ST25DVCTag)){}

 

 

Did anyone face something similar?
Any leads will be greatly appreciated.

18 REPLIES 18
victor laraison
ST Employee

hi Aly,

Firtsly, thx for your interest with our ST25 products.

Regarding your issuue, please, could you add abreakpoint then send me the information of "st25sdkTag" variable ? 
It could help.

Apart from that, are you using the iOSReaderSession.swift file into your own app ? or something else ? 

How is it done the instantiation of the tag when it is detected ? 

 

Keep in touch. 

 

 

Hello victor,

 

Thankyou very much for your responce.

I am using all the same methodologies as in the NFCTap app. Infact im using the same iOSReaderSession instance as well.

Here I have also attached my debug window. (My goal is to only be able to activate mailbox.)

Screenshot 2024-11-08 at 12.58.25.png

victor laraison
ST Employee

thx for info.

It would seem your type5tag is not instanciated correctly. 

Have you called the function "instantiateTag" (from Model/TagInfoHelper.swift) somewhere into your code ? 

if not, please have a look into iOSReaderSession.swift file where we call the instantiate method for getting the ST25Tag product (in red color) : 

self.mComStSt25sdkRFReaderInterface = iOSRFReaderInterface(aNFCTag: mNFCTag,aSession: session)

// Try/Catch for Exceptions from OBJC calls
SwiftTryCatch.try({
do {
var tag:ComStSt25sdkNFCTag?
if (self.mTagSystemInfo == nil){
tag = ComStSt25sdkNFCTag.init(comStSt25sdkRFReaderInterface: self.mComStSt25sdkRFReaderInterface)
}else{
self.mTagSystemInfo.instantiateTag(RFReaderInterface: self.mComStSt25sdkRFReaderInterface)
tag = self.mTagSystemInfo.getTagInstance()
}

if self.mtagReaderSessionViewControllerDelegate != nil {
try self.mtagReaderSessionViewControllerDelegate.handleTag(st25SDKTag: tag!, uid: mTagUid)
}else if self.mtagReaderSessionViewControllerDelegateWithFinallyBlock != nil {
try self.mtagReaderSessionViewControllerDelegateWithFinallyBlock.handleTag(st25SDKTag: tag!, uid: mTagUid)
}else{
session.invalidate(errorMessage: "Controller Delegate not existing")
}
} catch {
// Catch something here if not handling throw from ObjC
}
}
, catch: { (error) in
if self.mtagReaderSessionViewControllerDelegate != nil {
self.mtagReaderSessionViewControllerDelegate.handleTagST25SdkError(didInvalidateWithError: error!)
}

}
, finallyBlock: {
if self.mtagReaderSessionViewControllerDelegateWithFinallyBlock != nil {
self.mtagReaderSessionViewControllerDelegateWithFinallyBlock.handleFinallyBlock()
} else {
self.mComStSt25sdkRFReaderInterface.sessionInvalidate()
}
//
})

}

 

Hello Victor,

 

Yes, the code for instantiation was already inside iOSReaderSession as I imported the complete session file into my project.

So, this the flow:

Firs the iOSReaderSession calls 

 

mTagSystemInfo.instantiateTag(RFReaderInterface: self.mComStSt25sdkRFReaderInterface)

 

Second, it asks for instance with 

 

mTagSystemInfo.getTagInstance()

 

 

Since, this already exists, what else could be wrong?

victor laraison
ST Employee

pb is that the mTagSystemInfo.ProductId is not defined, and set to default value. So , you get generic type5 as tag.
I suggest you to have a look into "TagInfoHelper.swift" and "readTagInfo.swift" to know how to call the "setProductId" function with correct parameter. 

func setProductID (productID: ComStSt25sdkTagHelper_ProductID) {
self.productID = productID
}

 

In first, you have to getSystemInfo that give you tag information :

let response:Data = (miOSIso15693Tag?.getSystemInfo())!
if (response[0] == 0x00){
let dfsid:Int = Int(response[10])
let afi:Int = Int(response[11])
let numberOfBlocks:Int = Int(response[12])+1
let blockSize:Int = Int(response[13])
let icRef:Int = Int(response[14])

self.mTagSystemInfo = TagInfo(uid : mUID!, dfsid: dfsid, afi: afi, blockSize: blockSize, numberOfBlocks: numberOfBlocks, icRef: icRef)

}

 

then, call the TagInfoHelper.decodeProductID function for getting ProductId 

 pdt = decodeProductID(uid: self.mTagSystemInfo.uid, tag: mNFCTag!, icRef: self.mTagSystemInfo.icRef, self.mTagSystemInfo.numberOfBlocks)
self.mTagSystemInfo.setProductID(productID: pdt)

 

And finally, whenever you will instance tag, you will get right tag info.

Hope it helps.

 

Hey Victor,

 

This was a very helpful thing to point out as my iOSReaderSession was never setting the product ID.

Upon further inspection, I noticed that the functionality already existed inside TagInfoHelper and TagInfoType5.

 

Therefore, upon detecting a tag, I now call following so that the product ID is set.

 

let isValidCCFile = tagInfoType5.tagInformationProcess()
                                if (isValidCCFile == true){
                                    self.stopTagReaderSession()
                                } else {
                                    self.stopTagReaderSession("No valid CCFile for NDEF record : please, update your CCFile into Menu => CC File Editor")
                                }

 

 

But sadly, even after doing that, the results are same, and the tag type cast always fails.

What else could be missing?

 

p.s: I have also attached code segment for clarification.

 

My Tag handler:

Screenshot 2024-11-09 at 15.54.21.png

iOSReaderSession

Screenshot 2024-11-09 at 15.54.46.png

victor laraison
ST Employee

Hi Aly,
Please, could you send me the log of variable "tag" when you instantiate it ? 

victorlaraison_0-1731400183944.png

Thx and br,

Vincent 

Hey Vincent,

 

Sure, I have attached the debug log here,

Please let me know what you find:

Screenshot 2024-11-12 at 10.58.15.png

 

Thanks in advance.

Best Regards,

Aly

Hi again Aly,

I see that your ProductId is still set to ProdutUnknown.

victorlaraison_0-1731419118214.png

Please, check that functions for tag identification are called correctly into your code. ref to previous post above.