Hey guys,
I need to work with some Objective-C classes from Java-8.
I'm working with MacOs10.11
If I try the sample (high level api) code, it works fine.
This is the code:
// Obtain reference to Singleton instance of Objective-C client
Client c = Client.getInstance();
// Create a new mutable array
Proxy array = c.sendProxy("NSMutableArray", "array");
array.send("addObject:", "Hello");
array.send("addObject:", "World");
array.send("addObject:", "Test String");
assertEquals(3, array.sendInt("count"));
String lastString = array.sendString("lastObject");
assertEquals("Test String", lastString);
But if I try it with other classes, it doesn't work and my application is crashin with this error:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fff8ba47d32, pid=41313, tid=5891
#
# JRE version: Java(TM) SE Runtime Environment (8.0_66-b17) (build 1.8.0_66-b17)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.66-b17 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libsystem_c.dylib+0xd32] strlen+0x12
I need to work with NSPrintInfo, NSPrintOperation and PDFDocument.
That's my code:
Client c = Client.getInstance();
Proxy nsPrintInfo = c.sendProxy("NSPrintInfo", "printinfo");
Proxy pdfDocument = c.sendProxy("PDFDocument", "pdfDocument");
Proxy nsPrintOperation = c.sendProxy("NSPrintOperation", "nsPrintOperation", "pdfDocument");
nsPrintInfo.send("setTopMargin:", "0.0");
nsPrintInfo.send("setBottomMargin:", "0.0");
nsPrintInfo.send("setLeftMargin:", "0.0");
nsPrintInfo.send("setRightMargin:", "0.0");
nsPrintInfo.send("setHorizontalPagination:", "NSFitPagination");
nsPrintInfo.send("setVerticalPagination:", "NSFitPagination");
nsPrintInfo.send("setPaperSize:", "NSMakeSize(595.275591, 841.88976378)");
pdfDocument.send("initWithURL:", filename);
nsPrintOperation.send("setShowsPrintPanel:", "NO");
nsPrintOperation.send("setShowsProgressPanel:", "NO");
boolean succeed = nsPrintOperation.sendBoolean("runOperation");
I get the crash with Proxy nsPrintInfo = c.sendProxy("NSPrintInfo", "printinfo");
I hope you can help me.
Thanks :)