Commandline Tool Help - NSDistantObject and NSConnection
Commandline Tool Help - NSDistantObject and NSConnection
- Subject: Commandline Tool Help - NSDistantObject and NSConnection
- From: aaron smith <email@hidden>
- Date: Sun, 1 Nov 2009 16:07:57 -0800
hey Folks, quick question.
I'm building an app that I'm providing a command line tool for. I have it
hooked up and working. However the strange thing is that it works the first
time it's run, but then just throws exceptions.
I'm using a proxy object, which is exposed through NSConnection, and through
NSDistantObject it exposes one method to open a document at a path.
The application is using the document architecture, and I subclass
NSDocumentController. The cliproxy is setup in the document controller code
because it's initialized only once.
here's some code:
The commandline tool code:
http://pastebin.com/m6c1bb952
Here's the proxy code
h: http://pastebin.com/me651e88
m: http://pastebin.com/m57e4ab4e
The (simplified) doc controller:
http://pastebin.com/m6adf5d96
So what's strange is that it works fine on the first time I run the command
line tool; it opens the app, and opens a document as expected. But if the
cocoa application is already running - i'm seeing different behavior.
here's a quick sequence::
*first run*
$ ./build/Debug/gity
2009-11-01 16:01:33.895 gity[10625:903] proxy: <GTCLIProxy: 0x101e19030>
2009-11-01 16:01:33.898 gity[10625:903] proxy: <GTCLIProxy: 0x101e19030>
2009-11-01 16:01:33.899 gity[10625:903] doc: <GTDocumentController:
0x101e19570>
*second run (app is running)*
$ ./build/Debug/gity
2009-11-01 16:01:54.777 gity[10807:903] proxy: <GTCLIProxy: 0x101e19030>
2009-11-01 16:01:54.780 gity[10807:903] doc: <GTDocumentController:
0x101e19570>
2009-11-01 16:01:54.784 gity[10807:903] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '[NOTE: this exception
originated in the server.]
*** -[NSDistantObject methodSignatureForSelector:]: remote object does not
recognize selector: 'isEqual:''
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff854245a4
__exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff80d31313
objc_exception_throw + 45
2 Foundation 0x00007fff83b21277 -[NSConnection
sendInvocation:internal:] + 4304
3 CoreFoundation 0x00007fff853f737c ___forwarding___
+ 860
4 CoreFoundation 0x00007fff853f3458
_CF_forwarding_prep_0 + 232
5 gity 0x0000000100001740 main + 471
6 gity 0x000000010000134c start + 52
7 ??? 0x0000000000000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Abort trap
*third run (app is running, but no windows are open)*
$ ./build/Debug/gity
2009-11-01 16:02:24.232 gity[10904:903] proxy: <GTCLIProxy: 0x101e19030>
2009-11-01 16:02:24.235 gity[10904:903] doc: <GTDocumentController:
0x101e19570>
2009-11-01 16:02:24.315 gity[10904:903] *** Terminating app due to uncaught
exception 'NSObjectInaccessibleException', reason: '[NOTE: this exception
originated in the server.]
NSDistantObject (0x101e2e030) is invalid (no connection)'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff854245a4
__exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff80d31313
objc_exception_throw + 45
2 Foundation 0x00007fff83b21277 -[NSConnection
sendInvocation:internal:] + 4304
3 CoreFoundation 0x00007fff853f737c ___forwarding___
+ 860
4 CoreFoundation 0x00007fff853f3458
_CF_forwarding_prep_0 + 232
5 gity 0x0000000100001740 main + 471
6 gity 0x000000010000134c start + 52
7 ??? 0x0000000000000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Abort trap
So there are a couple things that I'm unsure of here. One of the errors is
complaining that the distant object doesn't respond to isEqual. and another
error is saying that the object is inaccessible, but the NSLog's above it
clearly log out an object..
any help is appreciated.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden