NSInvocation: Restrictions Adding and Retaining Args : Undocumented??
NSInvocation: Restrictions Adding and Retaining Args : Undocumented??
- Subject: NSInvocation: Restrictions Adding and Retaining Args : Undocumented??
- From: Jerry Krinock <email@hidden>
- Date: Mon, 5 Oct 2009 13:57:55 -0700
--> The documentation for -retainArguments states...
"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.... Discussion: Before this method is invoked,
argumentsRetained returns NO; after, it returns YES."
--> The documentation for -setArgument:atIndex: states...
"Sets an argument of the receiver."
***
This documentation leaves some questions unanswered....
* What if I want to send -retainArguments before all arguments are
added? Will arguments that are added later have their arguments
retained, because the branch for doing so reads the value of
'argumentsRetained'?
* Is it necessary to add setArguments:: in order? For example, if the
method's signature has two arguments, can I add an argument at index
3, and then later add an argument at index 2?
Hint: The documentation does not say so, but it seems that if I add an
argument at index 3 and then immediately invoke -retainArguments, it
crashes [1], but no exception is noted.
Sincerely,
Jerry Krinock
[1] Call Stack for The Crash (Mac OS X 10.5.8)
#0 0x9305e084 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-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