@@ -71,16 +71,6 @@ const xpc_type_string = getPtr("_xpc_type_string");
7171const xpc_type_uint64 = getPtr ( "_xpc_type_uint64" ) ;
7272const xpc_type_uuid = getPtr ( "_xpc_type_uuid" ) ;
7373
74- // check which version of decoder we have
75- var NSXPCDecoderDecodeMethod = "old"
76- var connResult = null ;
77-
78- var decoder = NSXPCDecoder . alloc ( ) . init ( ) ;
79-
80- if ( ( connResult = decoder [ "- setConnection:" ] ) != null ) {
81- NSXPCDecoderDecodeMethod = "new" ;
82- }
83-
8474// helper function that will create new NativeFunction
8575function getFunc ( name , ret_type , args ) {
8676 return new NativeFunction ( Module . getExportByName ( null , name ) , ret_type , args ) ;
@@ -250,10 +240,10 @@ function getKeys(description) {
250240// https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/Foundation.framework/NSXPCDecoder.h
251241function parseBPList ( conn , dict ) {
252242 var decoder = NSXPCDecoder . alloc ( ) . init ( ) ;
253- if ( NSXPCDecoderDecodeMethod == "old" ) {
243+ try {
244+ decoder [ "- _setConnection:" ] ( conn ) ;
245+ } catch ( err ) {
254246 decoder [ "- set_connection:" ] ( conn ) ;
255- } else {
256- decoder [ "- setConnection:" ] ( conn ) ;
257247 }
258248 decoder [ "- _startReadingFromXPCObject:" ] ( dict ) ;
259249 var debugDescription = decoder . debugDescription ( ) ;
0 commit comments