Reputation:
I'm trying to set up an NSinvocation to upload a picture to a website. I'm doing this:
After digging for a little while, It looks like if I add a UIImage as an argument to my NSInvocation object, then try to get it back out... I am returned a different memory address! Is this normal?
//First I have a valid UIImage "imgHolder" which has a memory address of "A"...
NSInvocation *myInvocation = [NSInvocation invocationWithMethodSignature:...
[myInvocation setArgument:imgHolder atIndex:5];
//Now, the weird part...
UIImage *checkImg;
[myInvocation getArgument:&checkImg atIndex:12];
//checkImg has a memory address of "B"!
if I try to work with checkImg, I get various exceptions which leads me to believe it's not a valid UIImage.
Any ideas what's going on? Shouldn't the memory address of checkImg be identical to that of imgHolder?
Upvotes: 1
Views: 372
Reputation: 6255
[myInvocation setArgument:imgHolder atIndex:5];
If imgHolder is a UIImage*, you should pass &imgHolder, not imgHolder.
Upvotes: 1