Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 23 Oct 2014, at 04:31, Greg Parker wrote: > > >> On Oct 22, 2014, at 12:04 PM, Gerriet M. Denkmann >> wrote: >> >>> On 23 Oct 2014, at 01:37, Scott Ribe wrote: >>> >>> On Oct 22, 2014, at 12:19 PM, Jonathan Mitchell >>> wrote: Surely the code that returns the object point

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Greg Parker
> On Oct 22, 2014, at 12:04 PM, Gerriet M. Denkmann > wrote: > >> On 23 Oct 2014, at 01:37, Scott Ribe wrote: >> >> On Oct 22, 2014, at 12:19 PM, Jonathan Mitchell >> wrote: >>> >>> Surely the code that returns the object pointed to by temp has to ensure >>> that the object has been corre

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Scott Ribe
> On Oct 22, 2014, at 1:04 PM, Gerriet M. Denkmann wrote: > > So, indeed, __autoreleasing seems to be the answer. > ( __autoreleasing is used to denote arguments that are passed by reference > (id *) and are autoreleased on return.) Honestly, my read was that it was for by-reference arguments

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 23 Oct 2014, at 01:37, Scott Ribe wrote: > > On Oct 22, 2014, at 12:19 PM, Jonathan Mitchell > wrote: >> >> Surely the code that returns the object pointed to by temp has to ensure >> that the object has been correctly retained? > > So, maybe __autorelease? Tried: [ iv invoke ]; NSDic

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Scott Ribe
On Oct 22, 2014, at 12:19 PM, Jonathan Mitchell wrote: > > Surely the code that returns the object pointed to by temp has to ensure that > the object has been correctly retained? So, maybe __autorelease? -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voi

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Scott Ribe
On Oct 22, 2014, at 12:10 PM, Gerriet M. Denkmann wrote: > > I tried, but got told: "error: ARC forbids explicit message send of 'retain'". Yep, makes sense. Is the method signature's method return type correct? If so, your two options would seem to be: - one of those compiler incantations wit

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Jonathan Mitchell
> On 22 Oct 2014, at 19:10, Gerriet M. Denkmann wrote: > > >> On 23 Oct 2014, at 01:02, Scott Ribe wrote: >> >> On Oct 22, 2014, at 11:46 AM, Gerriet M. Denkmann >> wrote: >>> >>> But how to fix this? >> >> ARC expects a retained pointer; I'd retain it. > > I tried, but got told: "error

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 23 Oct 2014, at 01:02, Scott Ribe wrote: > > On Oct 22, 2014, at 11:46 AM, Gerriet M. Denkmann > wrote: >> >> But how to fix this? > > ARC expects a retained pointer; I'd retain it. I tried, but got told: "error: ARC forbids explicit message send of 'retain'". NSDictionary *temp; [ iv

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Scott Ribe
On Oct 22, 2014, at 11:46 AM, Gerriet M. Denkmann wrote: > > But how to fix this? Can you actually retain a pointer that ARC expects to be already retained, or would be it a NOOP? Sorry, I only use manual memory management, so my previous reply may have been off-base. -- Scott Ribe scott_r.

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Scott Ribe
On Oct 22, 2014, at 11:46 AM, Gerriet M. Denkmann wrote: > > But how to fix this? ARC expects a retained pointer; I'd retain it. Things can get weird when calling across boundaries like NSInvocation, or function pointers, or whatever. Even weirder when the calls go between differ

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Kyle Sluder
On Wed, Oct 22, 2014, at 12:46 PM, Gerriet M. Denkmann wrote: > This seems to prove your guess that " the bug is the call to > -getReturnValue:". > > But how to fix this? Rewrite your API to take an array of blocks instead? --Kyle Sluder ___ Cocoa-dev

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 22 Oct 2014, at 03:17, Greg Parker wrote: > > >> On Oct 21, 2014, at 2:44 AM, Gerriet M. Denkmann >> wrote: >> >> 10.10, Xcode 6.1, using Arc. >> >> The following code works fine, with USE_INVOCATION defined or not: > > [...] > >> Without USE_INVOCATION defined, I get some compiler w

Re: NSInvocation crashes in AutoreleasePool

2014-10-21 Thread Greg Parker
> On Oct 21, 2014, at 2:44 AM, Gerriet M. Denkmann wrote: > > 10.10, Xcode 6.1, using Arc. > > The following code works fine, with USE_INVOCATION defined or not: [...] > Without USE_INVOCATION defined, I get some compiler warning about potential > leaks, because selector is unknown. > > But

NSInvocation crashes in AutoreleasePool

2014-10-21 Thread Gerriet M. Denkmann
]; NSInvocation *iv = [ NSInvocation invocationWithMethodSignature: signature ]; iv.target = self; iv.selector = theSelector; #endif // USE_INVOCATION NSMutableSet *outputSet

Re: Why would a working -[NSInvocation invoke] call NSBeep() ?

2011-12-21 Thread Jerry Krinock
On 2011 Dec 05, at 13:14, Greg Parker wrote: > You should file a bug report asking for -beginSheet:... to log a real error > message or throw an exception instead of beeping. Done (a few weeks ago, forgot to send this). Problem ID is 10557689. ___

Re: Why would a working -[NSInvocation invoke] call NSBeep() ?

2011-12-05 Thread Greg Parker
On Dec 4, 2011, at 5:49 PM, Jerry Krinock wrote: > At one point, running in Mac OS 10.7, one of my invocations gets invoked, and > … > > #00x913761fa in NSBeep > #10x9b6f0e1d in __invoking___ > #2 0x9b6f0d59 in -[NSInvocation invoke] > #30x976458ea in __NSFi

Re: Why would a working -[NSInvocation invoke] call NSBeep() ?

2011-12-04 Thread Kyle Sluder
On Dec 4, 2011, at 5:49 PM, Jerry Krinock wrote: > At one point, running in Mac OS 10.7, one of my invocations gets invoked, and > … > > #00x913761fa in NSBeep > #10x9b6f0e1d in __invoking___ > #2 0x9b6f0d59 in -[NSInvocation invoke] > #30x976458ea in __NSFi

Why would a working -[NSInvocation invoke] call NSBeep() ?

2011-12-04 Thread Jerry Krinock
At one point, running in Mac OS 10.7, one of my invocations gets invoked, and … #0 0x913761fa in NSBeep #1 0x9b6f0e1d in __invoking___ #2 0x9b6f0d59 in -[NSInvocation invoke] #3 0x976458ea in __NSFireDelayedPerform #4 0x9b6b0996 in

Re: blocks and NSInvocation question

2011-04-11 Thread Ken Thomases
On Apr 10, 2011, at 11:53 PM, John Michael Zorko wrote: > I'm stumped as to why this generates a warning when I compile. Do I need to > do something special with my AVURLAsset * to be able to access it from inside > the block in order to add it to an NSInvocation? >

blocks and NSInvocation question

2011-04-10 Thread John Michael Zorko
Hello, all ... I'm stumped as to why this generates a warning when I compile. Do I need to do something special with my AVURLAsset * to be able to access it from inside the block in order to add it to an NSInvocation? for (int index = 0; index < [assetsToLoad count

Re: [Q] Using NSInvocation vs. selector with NSTimer

2010-10-18 Thread JongAm Park
On 10/18/2010 9:45 AM, Keary Suska wrote: On Oct 18, 2010, at 9:00 AM, JongAm Park wrote: Is there any benefit in using it? My guess is that an NSInvocation instance is used repeatedly, but using the "selector" based method is not inconvenient for the most of cases. Is there

Re: [Q] Using NSInvocation vs. selector with NSTimer

2010-10-18 Thread Keary Suska
On Oct 18, 2010, at 9:00 AM, JongAm Park wrote: >>> Is there any benefit in using it? My guess is that an NSInvocation instance >>> is used repeatedly, but using the "selector" based method is not >>> inconvenient for the most of cases. >>> Is the

Re: [Q] Using NSInvocation vs. selector with NSTimer

2010-10-18 Thread JongAm Park
On 10/17/2010 4:11 PM, Joar Wingfors wrote: On 17 okt 2010, at 15.51, JongAm Park wrote: Although I know that NSInvocation was added (from Leopard?), I didn't use it much. NSInvocation predates Mac OS X... Oh. right. I forgot that. Is there any benefit in using it? My guess is th

Re: [Q] Using NSInvocation vs. selector with NSTimer

2010-10-17 Thread Joar Wingfors
On 17 okt 2010, at 15.51, JongAm Park wrote: > Although I know that NSInvocation was added (from Leopard?), I didn't use it > much. NSInvocation predates Mac OS X... > Is there any benefit in using it? My guess is that an NSInvocation instance > is used repeatedly, but us

[Q] Using NSInvocation vs. selector with NSTimer

2010-10-17 Thread JongAm Park
Hello, I have used scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: or timerWithTimeInterval:target:selector:userInfo:repeats: Although I know that NSInvocation was added (from Leopard?), I didn't use it much. Is there any benefit in using it? My guess is that an NSInvoc

Re: NSProxy/NSInvocation question

2010-06-28 Thread Paul Forgey
ard > invocations. I have read previous mailing list posts on this topic. > > For reasons I cannot explain and shouldn't be happening according to my > interpretation of the documentation, [NSInvocation selector] is throwing an > NSInvalidArgumentException: > > - (void)fo

NSProxy/NSInvocation question

2010-06-28 Thread Paul Forgey
I am writing an NSProxy subclass to generically marshal and forward invocations. I have read previous mailing list posts on this topic. For reasons I cannot explain and shouldn't be happening according to my interpretation of the documentation, [NSInvocation selector] is throwi

Re: NSInvocation error when closing a dirty document

2010-04-12 Thread Brad Stone
The view that has the combo box, for example, has a Object Controller (called "NoteObjectController) binded to my file's owner (MyDocument : NSDocument) with the Model Key Path to the MOC and the object controller is an entity of my model I created in Core Data. The combo box is binded to the a

Re: NSInvocation error when closing a dirty document

2010-04-11 Thread Jerry Krinock
Brad, you're overriding a method for a strange purpose, and it looks like you're examining an argument to see if it is a certain Apple private selector, and all this is done to achieve something which is quite ordinary, namely binding your data model to a combo box and a text view. When you fin

Re: NSInvocation error when closing a dirty document

2010-04-11 Thread Brad Stone
For future reference, I needed to end editing in the textView or the combo boxes to prevent the NSInvocation error. I did this by making the window the firstResponder in my NSDocument class with the saveDocumentWithDelegate method only when the window is being closed. This is not necessary

Re: NSInvocation error when closing a dirty document

2010-04-10 Thread Jerry Krinock
I get the following error > between the "Do you want to save" sheet and the save panel: > > [58341:a0f] +[NSInvocation invocationWithMethodSignature:]: method signature > argument cannot be nil > If I make the document dirty by typing text into any of the combo boxes or &

NSInvocation error when closing a dirty document

2010-04-10 Thread Brad Stone
; sheet and the save panel: [58341:a0f] +[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil Yes, I know something is nil but I have not ventured into any of the methods that handle this behavior (I start with SaveDocument) and I don't know exactly what is n

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-31 Thread Gwynne Raskind
inuous rewriting. I would guess that they pulled direct support for it out of NSInvocation and the runtime API because 1) it involves parsing Objective-C type encoding strings, and 2) it's unsafe to save stack frames (more below). Based on some of the changes they made in the modern runtime and the c

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-30 Thread Gwynne Raskind
On Mar 30, 2010, at 2:54 PM, Michael Ash wrote: >> I see, I really wasn't enough clear. Lets say, I have a method >> >> - someMethodWithArgument:(struct *)anArgument >> andSomeOtherArgument:(id)anotherArgument >> { >> // Here I want to create an

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-30 Thread Michael Ash
On Mon, Mar 29, 2010 at 2:15 PM, Philip Mötteli wrote: > Hi, > > > Am 29.03.2010 um 18:52 schrieb A.M.: >> >> On Mar 29, 2010, at 11:07 AM, Philip Mötteli wrote: >> >>> I need to temporary save the invocation of a method. For that, I just need >>

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Philip Mötteli
Am 29.03.2010 um 22:14 schrieb Jerry Krinock: > On 2010 Mar 29, at 12:53, Philip Mötteli wrote: > >> Am 29.03.2010 um 21:31 schrieb Jerry Krinock: >> >>> It handles all argument types > > Correction. I forgot one little limitation, per NSInvocation d

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Philip Mötteli
ifferent argument type dynamically. > > Maybe I don't understand, but a couple years ago I wrote this little method > that creates an invocation in one line of code > > + (NSInvocation*)invocationWithTarget:(id)target > selector:(SEL)selector >

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Jerry Krinock
couple years ago I wrote this little method that creates an invocation in one line of code + (NSInvocation*)invocationWithTarget:(id)target selector:(SEL)selector retainArguments:(BOOL)retainArguments argumentAddresses:(vo

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Philip Mötteli
Am 29.03.2010 um 20:49 schrieb Jerry Krinock: > On 2010 Mar 29, at 11:15, Philip Mötteli wrote: > >> - someMethodWithArgument:(struct *)anArgument >> andSomeOtherArgument:(id)anotherArgument >> { >> // Here I want to create an NSInvocation, capturing the call

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Philip Mötteli
Am 29.03.2010 um 20:36 schrieb Kyle Sluder: > On Mon, Mar 29, 2010 at 11:15 AM, Philip Mötteli > wrote: >> - someMethodWithArgument:(struct *)anArgument >> andSomeOtherArgument:(id)anotherArgument >> { >> // Here I want to create an NSInvocation, capturi

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Jerry Krinock
On 2010 Mar 29, at 11:15, Philip Mötteli wrote: > - someMethodWithArgument:(struct *)anArgument > andSomeOtherArgument:(id)anotherArgument > { > // Here I want to create an NSInvocation, capturing the call of this > method. Something like: > NSInvoca

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Kyle Sluder
On Mon, Mar 29, 2010 at 11:15 AM, Philip Mötteli wrote: > - someMethodWithArgument:(struct *)anArgument > andSomeOtherArgument:(id)anotherArgument > { >        // Here I want to create an NSInvocation, capturing the call of this > method. Something like: >        NSInvoca

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Philip Mötteli
Hi, Am 29.03.2010 um 18:52 schrieb A.M.: > > On Mar 29, 2010, at 11:07 AM, Philip Mötteli wrote: > >> I need to temporary save the invocation of a method. For that, I just need >> to put the stack frame into an NSInvocation. Unfortunately, Apple has >> remov

"-forwardInvocation:" like NSInvocation creation

2010-03-29 Thread Philip Mötteli
Hello, I need to temporary save the invocation of a method. For that, I just need to put the stack frame into an NSInvocation. Unfortunately, Apple has removed the -setStackFrame: from NSInvocation. Though they still use something like it, because they need it for -forwardInvocation:. Has

Re: [iPhone 3.1] NSInvocation on main thread?

2010-02-11 Thread Peter Blazejewicz
Hi John, NSInvocation can be invoked on main thread as any NSObject subclass simply by performing selector on itself on main thread, However I think you're looking for custom additions similar to that one blogged here (Dave Dribin's blog): http://www.dribin.org/dave/blog/archives/

[iPhone 3.1] NSInvocation on main thread?

2010-02-10 Thread John Michael Zorko
Hello, all ... I'm using NSInvocation so I can pass multiple arguments to delegate methods. However, I also want these delegate methods to get called on the main thread. Is there a way that I can use NSInvocation to call the method it wraps on the main thread, like performSelectorOnMainT

Re: NSInvocation and methods with non-pointer parameters

2009-11-02 Thread Bill Bumgarner
On Nov 2, 2009, at 2:17 AM, Jim Kang wrote: > I seem to be able to use NSInvocation to execute methods that have > parameters are pointers, like NSString* or NSDictionary*, but when I try to > invoke a method with a parameter that is not a point, like this - > > (void)methodWithCG

Re: NSInvocation and methods with non-pointer parameters

2009-11-02 Thread Jim Kang
Argh. I actually had invalid arguments, and there was indeed nothing wrong with the invocation code itself. Thanks for attempting to help! I'll make sure I'm less tired next time I post. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do n

Re: NSInvocation and methods with non-pointer parameters

2009-11-02 Thread Dave Keck
>            sig = [[self class] instanceMethodSignatureForSelector:sel]; See -methodSignatureForSelector. > What is the correct way to set the CGPoint argument to NSInvocation? The > CGPoint can't get released before the invocation is finished, so [invocation > retain] doesn&

NSInvocation and methods with non-pointer parameters

2009-11-02 Thread Jim Kang
I seem to be able to use NSInvocation to execute methods that have parameters are pointers, like NSString* or NSDictionary*, but when I try to invoke a method with a parameter that is not a point, like this - (void)methodWithCGPoint: (CGPoint)pos; - I get an EXC_BAD_ACCESS when I run it with

NSInvocation: Restrictions Adding and Retaining Args : Undocumented??

2009-10-05 Thread Jerry Krinock
305e084 in CFRetain #1 0x92fee084 in _CFArrayReplaceValues #2 0x935bc873 in -[NSCFArray insertObject:atIndex:] #3 0x935bc7e4 in -[NSCFArray addObject:] #4 0x930da5c9 in __NSI3 #5 0x930da994 in -[NSInvocation retainArguments]___ Cocoa-de

Re: NSInvocation or NSTimer with an arg

2009-09-17 Thread Hank Heijink (Mailinglists)
get it back in the method you pass in the selector argument by calling the -userInfo method on the NSTimer instance (see below). [...snip approach using NSInvocation...] but this approach requires roughly 7 extra lines of code every time I configure a cell for display (creating things like NSMe

Re: NSInvocation or NSTimer with an arg

2009-09-16 Thread Luther Baker
> > > Yep, that's what the userInfo parameter is for. It's an id, so you can pass > your UITableViewCell there, and get it back in the method you pass in the > selector argument by calling the -userInfo method on the NSTimer instance > (see below). > > [...snip app

Re: NSInvocation or NSTimer with an arg

2009-09-16 Thread Hank Heijink (Mailinglists)
n id, so you can pass your UITableViewCell there, and get it back in the method you pass in the selector argument by calling the -userInfo method on the NSTimer instance (see below). [...snip approach using NSInvocation...] but this approach requires roughly 7 extra lines of code every time I

NSInvocation or NSTimer with an arg

2009-09-16 Thread Luther Baker
[NSTimer scheduledTimerWithTimeInterval:<#(NSTimeInterval)ti#> target:<#(id)aTarget#> selector:<#(SEL)aSelector#> userInfo:<#(id)userInfo#> repeats:<#(BOOL)yesOrNo#> The other option is to use: [NSTimer scheduledTimerWithTimeInterval:<#(NSTimeInterval)ti#> invocation:<#(NSInvocation *

Re: Surprise: -[NSInvocation retainArguments] also Autoreleases them

2009-08-01 Thread Jerry Krinock
Thank you, Ken. Yes, your explanation -- that the NSInvocation retains them as instance variables -- makes more sense than mine. I submitted Document Feedback that Apple make clear what they mean by "retain" in this method. ___

Re: Surprise: -[NSInvocation retainArguments] also Autoreleases them

2009-08-01 Thread Ken Thomases
target and arguments. You have told the NSInvocation to do so, and it then has responsibility for releasing them. But I thought it was odd that the documentation did not say so explicitly, so I did a little experiment, and learned that - retainArguments also adds them to the autorelease pool!

Surprise: -[NSInvocation retainArguments] also Autoreleases them

2009-07-31 Thread Jerry Krinock
The document for -[NSInvocation retainArguments] tells me: "If the receiver hasn’t already done so, retains the target and all object arguments of the receiver and copies all of its C-string arguments. ... Newly created NSInvocations don’t retain or copy their arguments, nor do they r

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-13 Thread Marcel Weiher
On May 13, 2009, at 11:27 , Mike Mangino wrote: I'm noticing something related that is causing my problems. I have mocking working for custom types. When I try to change the class of a string, however, I get a crash. -(void) testImplementationOnString { NSString *s = [NSString st

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-13 Thread Mike Mangino
On May 12, 2009, at 6:19 PM, Greg Parker wrote: On May 12, 2009, at 6:43 AM, Michael Ash wrote: Use -methodForSelector: to get the IMP for a nonexistent method. This IMP will be a function pointer straight to the runtime's forwarding machinery. Then install that IMP as the implementation for y

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-12 Thread Michael Ash
On Tue, May 12, 2009 at 6:19 PM, Greg Parker wrote: > On May 12, 2009, at 6:43 AM, Michael Ash wrote: >> >> Use -methodForSelector: to get the IMP for a nonexistent method. This >> IMP will be a function pointer straight to the runtime's forwarding >> machinery. Then install that IMP as the implem

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-12 Thread Greg Parker
On May 12, 2009, at 6:43 AM, Michael Ash wrote: Use -methodForSelector: to get the IMP for a nonexistent method. This IMP will be a function pointer straight to the runtime's forwarding machinery. Then install that IMP as the implementation for your overridden methods. Callers will go straight in

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-12 Thread Michael Ash
On Tue, May 12, 2009 at 11:13 AM, Mike Mangino wrote: > > On May 12, 2009, at 9:43 AM, Michael Ash wrote: > [snip] >> >> This is actually surprisingly easy. >> >> (Caveat: I have not actually done this.) >> >> Use -methodForSelector: to get the IMP for a nonexistent method. This >> IMP will be a f

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-12 Thread Mike Mangino
On May 12, 2009, at 9:43 AM, Michael Ash wrote: [snip] This is actually surprisingly easy. (Caveat: I have not actually done this.) Use -methodForSelector: to get the IMP for a nonexistent method. This IMP will be a function pointer straight to the runtime's forwarding machinery. Then install

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-12 Thread Michael Ash
On Tue, May 12, 2009 at 8:50 AM, Mike Mangino wrote: > > On May 12, 2009, at 12:58 AM, Michael Ash wrote: > [snip] > >> >> My suggestion would be, if at all possible, avoid creating the >> NSInvocation manually at all. By far the nicest way to create an >> inv

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-12 Thread Mike Mangino
On May 12, 2009, at 12:58 AM, Michael Ash wrote: [snip] My suggestion would be, if at all possible, avoid creating the NSInvocation manually at all. By far the nicest way to create an invocation is by capturing it using the -forwardInvocation: method. That way you create it using the same

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-11 Thread Michael Ash
method call > through to the existing Mock recording code. It's based on NSProxy and > expects to receive and NSInvocation. > > Creating the NSInvocation is easy. I'm not sure, however, how to fill in the > parameters. The NSMethodSignature gives me the type encoding. I

Creating an NSInvocation from an NSMethodSignature

2009-05-11 Thread Mike Mangino
;s based on NSProxy and expects to receive and NSInvocation. Creating the NSInvocation is easy. I'm not sure, however, how to fill in the parameters. The NSMethodSignature gives me the type encoding. Is there a way to use this information along with the address of the self parameter

Re: NSInvocation

2008-09-19 Thread Michael Ash
On Wed, Sep 10, 2008 at 1:44 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > But if you use it to call a method which returns a struct, then it > crashes and burns. It doesn't even throw an exception, it just > segfaults. > > I've filed this as a bug as rdar://6210060. It really should work, but > it

Re: NSInvocation

2008-09-10 Thread Michael Ash
On Wed, Sep 10, 2008 at 1:03 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > And in case anybody is wondering how the heck this works when the > method isn't implemented, it's actually pretty straightforward. Cocoa > has an internal function which builds an NSInvocation fr

Re: NSInvocation

2008-09-10 Thread Michael Ash
hael Ash wrote: >>> >>>> And lastly, I recommend filing a bug against the documentation in this >>>> case. NSInvocation is not really suited for this particular task, and >>>> I don't understand why they would recommend it here. >>> >>&g

Re: NSInvocation

2008-09-10 Thread Ken Thomases
On Sep 10, 2008, at 10:24 AM, Michael Ash wrote: On Wed, Sep 10, 2008 at 11:13 AM, Ken Thomases <[EMAIL PROTECTED]> wrote: On Sep 10, 2008, at 9:52 AM, Michael Ash wrote: And lastly, I recommend filing a bug against the documentation in this case. NSInvocation is not really suited fo

Re: NSInvocation

2008-09-10 Thread Michael Ash
On Wed, Sep 10, 2008 at 11:13 AM, Ken Thomases <[EMAIL PROTECTED]> wrote: > On Sep 10, 2008, at 9:52 AM, Michael Ash wrote: > >> And lastly, I recommend filing a bug against the documentation in this >> case. NSInvocation is not really suited for this particular task, and &

Re: NSInvocation

2008-09-10 Thread Ken Thomases
On Sep 10, 2008, at 9:52 AM, Michael Ash wrote: On Wed, Sep 10, 2008 at 2:56 AM, Chris Idou <[EMAIL PROTECTED]> wrote: I have a need to call performSelector:withObject etc, except I need to pass 3 arguments. The doco to performSelector:withObject:withObject says to "See N

Re: NSInvocation

2008-09-10 Thread Michael Ash
On Wed, Sep 10, 2008 at 2:56 AM, Chris Idou <[EMAIL PROTECTED]> wrote: > > I have a need to call performSelector:withObject etc, except I need to pass 3 > arguments. The doco to performSelector:withObject:withObject says to "See > NSInvocation", which I have done, b

Re: NSInvocation

2008-09-10 Thread Sherm Pendley
On Wed, Sep 10, 2008 at 2:56 AM, Chris Idou <[EMAIL PROTECTED]> wrote: > > I have a need to call performSelector:withObject etc, except I need to pass > 3 arguments. The doco to performSelector:withObject:withObject says to "See > NSInvocation", which I have done, b

NSInvocation

2008-09-09 Thread Chris Idou
I have a need to call performSelector:withObject etc, except I need to pass 3 arguments. The doco to performSelector:withObject:withObject says to "See NSInvocation", which I have done, but I don't understand how to use it. Can anyone give me some code w

Re: Using NSInvocation for a class method?

2008-07-17 Thread Graham Cox
Duh, Silly me. For some reason I thought +class returned some opaque struct thanks, Graham On 18 Jul 2008, at 4:27 pm, Kyle Sluder wrote: On Fri, Jul 18, 2008 at 1:46 AM, Graham Cox <[EMAIL PROTECTED]> wrote: Can I use NSInvocation for a class method? I can't really see wh

Re: Using NSInvocation for a class method?

2008-07-17 Thread Kyle Sluder
On Fri, Jul 18, 2008 at 1:46 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > Can I use NSInvocation for a class method? I can't really see what to use > for setTarget: as there isn't an actual object. Erm? Just send messages to the Class object. Class objects return self

Using NSInvocation for a class method?

2008-07-17 Thread Graham Cox
Can I use NSInvocation for a class method? I can't really see what to use for setTarget: as there isn't an actual object. Or there might be a better way to do what I want to do... I'm trying to set up a simple scheme that maps file types to a method that can interpret and d

Re: NSInvocation question

2008-02-27 Thread Hank Heijink
On Feb 25, 2008, at 6:03 PM, Chris Suter wrote: Why don't you just do something like I suggested in my previous e- mail: For every callback you have, write a method on MyDocument: For example: - (void)doStartTrial { [self startTrial:trial]; // Store trial as an instance variable of MyDo

Re: NSInvocation question

2008-02-25 Thread Chris Suter
On 26/02/2008, at 1:49 AM, Hank Heijink wrote: I haven't been very clear, my apologies. I may have completely overlooked the best strategy, so let me try to explain what I'm doing. I have to call methods depending on certain conditions. These include passing of time, movement of the cursor

Re: NSInvocation question

2008-02-25 Thread Hank Heijink
On Feb 25, 2008, at 3:49 PM, Nir Soffer wrote: The docs don't tell if -invokeWithTarget: will retain the target, so call -setTarget:nil after invoking to be sure you don't create a retain cycle. As far as I understand the documentation, -[invokeWithTarget:] is equivalent to -[setTarget:]

Re: NSInvocation question

2008-02-25 Thread Nir Soffer
On Feb 21, 2008, at 18:22, Hank Heijink wrote: I have a document-based application, and my NSDocument subclass runs an experiment which amounts to invoking NSInvocations based on certain conditions. These NSInvocations retain their arguments, and the target of the NSInvocation is the

Re: NSInvocation question

2008-02-25 Thread Hank Heijink
That's essentially what I ended up doing: I need to save the other three instance variables of the MVActions, so for now I release the NSInvocation ivar before adding an MVAction to the array. Not very elegant maybe, but it does solve my problem. Thanks, Hank On Feb 25, 2008, at 3:

Re: NSInvocation question

2008-02-25 Thread Nir Soffer
On Feb 21, 2008, at 18:22, Hank Heijink wrote: I have a document-based application, and my NSDocument subclass runs an experiment which amounts to invoking NSInvocations based on certain conditions. These NSInvocations retain their arguments, and the target of the NSInvocation is the

Re: NSInvocation question

2008-02-25 Thread Hank Heijink
On Feb 22, 2008, at 8:47 PM, Chris Suter wrote: On 23/02/2008, at 2:36 AM, Hank Heijink wrote: The nice thing about NSInvocation is not so much its efficiency (or lack thereof, as the case may be), but the fact that once you've got the thing constructed, you can just call invoke

Re: NSInvocation question

2008-02-22 Thread Chris Suter
On 23/02/2008, at 2:36 AM, Hank Heijink wrote: The nice thing about NSInvocation is not so much its efficiency (or lack thereof, as the case may be), but the fact that once you've got the thing constructed, you can just call invoke on it, without having to think about what's

Re: NSInvocation question

2008-02-22 Thread Hank Heijink
On Feb 21, 2008, at 11:18 PM, Chris Suter wrote: I'm not sure what exactly you're trying to do, but NSInvocation isn't that fast a way of making a call. It's certainly going to somewhat slower than a compiler generated call and it's not NSInvocation's intended

Re: NSInvocation question

2008-02-21 Thread Nir Soffer
On Feb 21, 2008, at 18:22, Hank Heijink wrote: I have a document-based application, and my NSDocument subclass runs an experiment which amounts to invoking NSInvocations based on certain conditions. These NSInvocations retain their arguments, and the target of the NSInvocation is the

Re: NSInvocation question

2008-02-21 Thread Chris Suter
ve it a whirl. I'm not sure what exactly you're trying to do, but NSInvocation isn't that fast a way of making a call. It's certainly going to somewhat slower than a compiler generated call and it's not NSInvocation's intended use. If you want fast calls, you s

Re: NSInvocation question

2008-02-21 Thread Hank Heijink
uld release the NSInvocation *action when I put an MVAction in the array, but I wonder if there's a better method. You have a retain cycle - the document retain the array which retain the invocation, which retain the document. Ah. I didn't realize that an NSInvocation retains not only its