我是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]];
}