osx - App reply not called when passing non-null parameter from NSXPCConnection -



osx - App reply not called when passing non-null parameter from NSXPCConnection -

i'm using xpc seperate project 2 projects - main project, built os x @ 64-bit, , xpc service built os x @ 32-bit, using library not available 32 bit , cannot replaced. 2 communicate using nsxpcconnection.

i have problem callbacks service main app: when reply takes complicated argument (i.e: class nsimage or nsdata), not called xpc service. there no error or exception, nil happens. occurs other way, i.e., when calling proxy object. not occur randomly, happens reply signatures, though im not sure which.

i need pass nsimage in way between xpc service , main app. tried passing both nsimage , nsdata, reply not called (worth mentioning - beingness called when nil passed instead of real object).

i tried sending pointer using [nsdata bytes] re-creating info using [nsdata initwithdata:length:]. when seek this, reply called, exc_bad_access when calling initwithdata. assume because of mess between 32-bit , 64-bit addressing.

a few code samples:

when reply takes nsimage:

exported interface:

- (void)getimagewithreply:(void (^)(nsimage *image))reply;

reply called from:

- (void)getimagereply:(void (^)(nsimage *image))reply { //we re-render. responsibility not re-render when not needed passed on. [self render]; //updates puts in local var mrenderbuffer render info reply(nil, no); nsimage *image = ... //init image. beingness inited correctly, know reply(image); }'

when reply takes ptr data:

exported interface

typedef long long xpc_ptr; //as void* has different sizes in 32/64bit env. - (void)getrenderbufferwithreply:(void (^)(xpc_ptr ptr, uint size))reply;

reply called from:

- (void)getrenderbufferwithreply:(void (^)(reader_ptr ptr, uint size))reply { [self render]; reply((xpc_ptr)[mrenderbuffer bytes], mrenderwidth * mrenderheight * bytes_per_pixel, yes); }

it appears objects passed via connection must conform nssecurecoding protocol, nsimage not conform to.

nsdata conform protocol, , passing through connection (not sure why didn't work when tried nsdata earlier). creating nsimage in main process using sent data.

the effort send pointer in hindsight silly attempt, service , main app naturally run of different processes , mapped different physical memory space.

osx nsimage xpc nsxpcconnection

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -