こんにちは、私は UG10045.pdfに従ってiOSアプリケーションを作成しました。私はApduExchangeWithByteArrayメソッドを作成し、その内容を実装しました。ただし、タグからtaplinxライブラリに応答を返すと、デバイスログから次のエントリでアプリケーションがクラッシュします。
Time Device Name Type PID Tag Message
Nov 6 20:44:31 iPhone Notice 5223 MobileFacilityApp Command Set - 1
Nov 6 20:44:31 iPhone Notice 5223 MobileFacilityApp Command Set - Native
Nov 6 20:44:31 iPhone Error 0 kernel(Sandbox) Sandbox: MobileFacilityApp(5223) deny(1) sysctl-read kern.bootargs
Nov 6 20:44:38 iPhone Notice 5223 MobileFacilityApp(UIKitCore) Received memory warning.
Nov 6 20:44:38 iPhone Notice 5223 MobileFacilityApp(UIKitCore) Received memory warning.
Nov 6 20:44:40 iPhone Notice 0 kernel EXC_RESOURCE -> MobileFacilityApp[5223] exceeded mem limit: InactiveHard 3072 MB (fatal)
Nov 6 20:44:40 iPhone Notice 0 kernel memorystatus: killing process 5223 [MobileFacilityApp] in high band FOREGROUND (100) - memorystatus_available_pages: 44859空の応答をtaplinxライブラリに送り返すと(ResponseDataを設定せずにTL_TagAPDUResponse)、アプリはクラッシュせず、不完全な応答に関するエラーが発生します(これは予想されます)。私は何が間違っていますか?
@ukcas - Taplinx iOSライブラリのどのバージョンが「最新」ですか?私は2.0.0を持っており、 apduExchangeメソッドからTL_TagAPDUResponseを返すと間違いなくクラッシュするため、j2objcライブラリからの生のIOSByteArrayである必要があります。私はtaplinxライブラリにC#バインディングを使用していますが、この問題では問題ではありません。
こんにちは、ダミアン。
たぶん、エラーの原因は、TapLinxライブラリではなく、メモリ制限を超えていることですか?
MobileFacilityApp[5223] exceeded mem limit: InactiveHard 3072 MB (fatal)
TapLinxライブラリを統合したアプリケーションは、次のように使用できます(ApduExchangeを上に実装する必要はありません)。
代理オブジェクトを APDUHandler に設定する
let reader = TL_IOSNFCReader(uid: tag.identifier, historicalBytes: tag.historicalBytes ?? Data())
handler = TapLinxApduHandler(reader: reader)
handler.delegate = self
libraryManager?.setApduHandlerWithApduHandler(handler)
次のステップは、アプリケーション内にプロトコルメソッドを実装することです
func apduExchange(withByteArray apduData: Data) -> TL_TagAPDUResponse? {
var tagAPDUResponse: TL_TagAPDUResponse?
if connectedTag != nil {
// Send Tag Type Native of ISO and the apdu as NFCISO7816APDU
executeAPDUCommandOn7816Tag(tagType: tagtype, apdu: apdu) { data in
let appendedData = data
tagAPDUResponse = TL_TagAPDUResponse(responseData: appendedData, tag: self.currentTag)
semaphore.signal()
}
let _ = semaphore.wait(timeout: .now() + 3.0)
} else if connectedMifareTag != nil {
let semaphore = DispatchSemaphore(value: 0)
print("MIFARE CAPDU -> \(apduData.hex)")
executeAPDUCommandOnMIFARETag(apdu: apduData) { data in
print("RAPDU <- Data: \(data.hex)")
tagAPDUResponse = TL_TagAPDUResponse(responseData: data, tag: self.currentTag)
semaphore.signal()
}
let _ = semaphore.wait(timeout: .now() + 3.0)
}
print("Tag Response \(String(describing: tagAPDUResponse))")
return tagAPDUResponse
}
この単純化がお役に立てば幸いです。
よろしくお願いいたします。
TapLinxチーム
もう 1 つ、apduData は実際には NSData ではなく IOSByteArray でもあります
どうやらTapLinx-v2.0.0に含まれているヘッダーはすべて間違っているようです。TapLinxApduHandler.hには、宣言があります。
- (nullable TL_TagAPDUResponse *)apduExchangeWithByteArray:(NSData *_Nonnull)apduData;しかし、実際には IOSByteArray* を返す必要があります、そうでなければ、アプリは前述の症状でクラッシュします