Taplinx iOS crashes in apduExchange for command "Get Version" (0x60) when no data is returned

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Taplinx iOS crashes in apduExchange for command "Get Version" (0x60) when no data is returned

394 次查看
Octopussy
Contributor II

I see crashes of the SDK when using getVersionForDetectingDesFireCardType() when e.g. Tag is removed too quickly and the data is not fully received.

Here is what my code looks like (strip down to essential parts func

apduExchange(withByteArray apduData: Data) -> TL_TagAPDUResponse? {
var tagAPDUResponse: TL_TagAPDUResponse? Task { 
  do {
    let data = try await self.currentTag!.sendMiFareCommand(commandPacket: apduData)
    tagAPDUResponse = TL_TagAPDUResponse(responseData: data, tag: self.tagInfo) 
  } catch { 
  } 
} 
  return tagAPDUResponse // FIXME: if we have no data we return nil which causes an exception 
}

 

When sendMiFareCommand returns / throws an error for the getVersionCommand (0x60) then I can not return any data from the apduExchange. This is something the SDK code for getVersionForDetectingDesFireCardType can not deal with. Here is the log when this happens:

Command sent to card : 60 -[NFCTagReaderSession transceive:tagUpdate:error:]:897 Error Domain=NFCError Code=102 "Tag response error / no response" UserInfo={NSLocalizedDescription=Tag response error / no response, NSUnderlyingError=0x3031448a0 {Error Domain=nfcd Code=29 "Tag Error" UserInfo={NSLocalizedDescription=Tag Error, NSUnderlyingError=0x303144960 {Error Domain=com.apple.nfstack Code=20 "No response from tag" UserInfo={NSLocalizedDescription=No response from tag}}}}} Response received : null *** Terminating app due to uncaught exception 'Ryktinz', reason: 'com.nxp.nfclib.exceptions.InvalidResponseLengthException: Incomplete response' *** First throw call stack: (0x192d5a5fc 0x1902d5244 0x102cac90c 0x102de2d80 0x102a82688 0x10264b3bc 0x102648528 0x10264e8b5 0x102637991 0x102637aed 0x19e687e39) libc++abi: terminating due to uncaught exception of type Ryktinz The app will terminate. 

 

There is an easy way to reproduce this. If you change my code above to this then you will see the crash right away when you issue getVersionForDetectingDesFireCardType

apduExchange(withByteArray apduData: Data) -> TL_TagAPDUResponse? {
var tagAPDUResponse: TL_TagAPDUResponse? Task { 
  do {
    let data = try await self.currentTag!.sendMiFareCommand(commandPacket: apduData)
    // tagAPDUResponse = TL_TagAPDUResponse(responseData: data, tag: self.tagInfo) 
  } catch { 
  } 
} 
  return tagAPDUResponse // FIXME: if we have no data we return nil which causes an exception 
}

I also noticed even when data returned but the data is not the right content / size it will crash.

This is a real issue for my app right now.

Can you please fix this ASAP and release a new version of the SDK.

Let me know if you have any questions as I said this is very easy to reproduce.

Thanks, Martin

标签 (1)
标记 (4)
0 项奖励
回复
0 回复数