flutter-nfc-manager icon indicating copy to clipboard operation
flutter-nfc-manager copied to clipboard

iOS ISO7816Tag.sendCommand : error invalid_parameter, Tag is not found

Open cd-chen opened this issue 1 year ago • 0 comments

I have a requirement to continuously send sendCommand, but I received an error Tag that is not found. I need to improve it urgently

I can confirm that implementing OC like the following can effectively obtain the data I want

- (void)getPubkeyWith:(id<NFCISO7816Tag>)tag
{
    NFCISO7816APDU * iso  = [[NFCISO7816APDU alloc] initWithInstructionClass:0 instructionCode:0x0F p1Parameter:0 p2Parameter:0 data:data expectedResponseLength:-1];
    
    [tag sendCommandAPDU:iso completionHandler:^(NSData * _Nonnull responseData, uint8_t sw1, uint8_t sw2, NSError * _Nullable error) {
        if (error != nil) {
            self.xpubCount++;
            [self.xpubDataArray addObject:responseData];
            
            if (self.xpubCount < 5) {
                [self getPubkeyWith:tag];
            } else {
                // complete
            }
            
        } else {
            // end
        }
    }];
}

cd-chen avatar Jun 21 '24 03:06 cd-chen