Для работы с компонетом из Objective C требуется модуль libfptr_objc.h.
#import <Foundation/Foundation.h>
#import "libfptr10_objc.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
IFptr *fptr = [[IFptr alloc] init];
NSLog(@"Version: %@", [fptr version]);
[fptr applySingleSettings];
[fptr open];
[fptr setParam:1021 NSStringParam:@"Иванов И.И."];
[fptr setParam:1203 NSStringParam:@"500100732259"];
[fptr operatorLogin];
[fptr setParam:1008 NSStringParam:@"+79161234567"];
[fptr openReceipt];
[fptr setParam:1212 intParam:1];
[fptr setParam:1214 intParam:7];
[fptr registration];
[fptr receiptTotal];
[fptr payment];
if ([fptr closeReceipt] < 0)
{
[fptr checkReceiptClosed];
if (![fptr getParamBool:LIBFPTR_PARAM_RECEIPT_CLOSED])
{
exit(255);
}
}
[fptr fnQueryData];
[fptr beginNonfiscalDocument];
[fptr printText];
[fptr printText];
[fptr printText];
[fptr setParam:
LIBFPTR_PARAM_BARCODE NSStringParam:
@"https://check.egais.ru?id=cf1b1096-3cbc-11e7-b3c1-9b018b2ba3f7"];
[fptr printBarcode];
[fptr printText];
[fptr setParam:
LIBFPTR_PARAM_TEXT NSStringParam:
@"https://check.egais.ru?id=cf1b1096-3cbc-11e7-b3c1-9b018b2ba3f7"];
[fptr printText];
[fptr printText];
NSStringParam:@"10 58 1c 85 bb 80 99 84 40 b1 4f 35 8a 35 3f 7c "
@"78 b0 0a ff cd 37 c1 8e ca 04 1c 7e e7 5d b4 85 "
@"ff d2 d6 b2 8d 7f df 48 d2 5d 81 10 de 6a 05 c9 "
@"81 74"];
[fptr printText];
[fptr endNonfiscalDocument];
[fptr report];
[fptr fnQueryData];
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSLog(@"First unsent document = %d (%@)", unsentFirstNumber, [formatter stringFromDate:unsentDateTime]);
NSLog(@"Unsent count = %d", unsentCount);
[fptr close];
}
return 0;
}