0

我是 Objective-C 编码和智能卡编程的新手。我正在为 iPhone 开发应用程序。我发现使用 iSmartSDK 从智能卡读取文件有困难,它返回 NULL,尽管 Applet 的选择是成功的。有没有人遇到过这样的问题或知道这个?谢谢

t0Command.classByte = 0;
t0Command.instructionByte = 0xCB;
t0Command.parameter1Byte = 0x3F;
t0Command.parameter2Byte = 0xFF;
t0Command.dataBytes = nil;
t0Command.lengthByte = t0Command.dataBytes.length;
t0Command.expectedResponseLengthByte = 0x7F;

t0Command.dataBytes = [self hexStringToBytes:@"5C035FC105"];

t0Command.commandId = READ_WRITE_CPU_CARD_COMMAND_ID;
resultCommand = [iSmartInstance sendCommandToCPUCard:t0Command];
if (resultCommand == nil) {
    [self displayMessage:@"Read Binary Failed"];
}
else{
    [self displayMessage:[NSString stringWithFormat:@"Read Status: %02x%02x", ((T0Command*)resultCommand).status1Byte, ((T0Command*)resultCommand).status2Byte]];
    [self displayMessage:[NSString stringWithFormat:@"Response Length: %d", ((T0Command*)resultCommand).dataBytes.length]];
    NSString *readBytes = [[[NSString alloc] initWithBytes:((T0Command*)resultCommand).dataBytes.bytes 
                                                    length:((T0Command*)resultCommand).dataBytes.length 
                                                  encoding:NSASCIIStringEncoding] autorelease];

    [self displayMessage:[NSString stringWithFormat:@"Read Value: %@ \n Bytes: %@", readBytes, ((T0Command*)resultCommand).dataBytes.bytes]];
}
4

0 回答 0