Re: Using CFMutableDictionaryRef
Re: Using CFMutableDictionaryRef
- Subject: Re: Using CFMutableDictionaryRef
- From: Fritz Anderson <email@hidden>
- Date: Sun, 28 Feb 2010 17:56:42 -0600
On 28 Feb 2010, at 5:09 PM, Alexander Hartner wrote:
> CFDictionaryAddValue(aTouchSession, touch, pointDict);
> NSLog(@"Stored Touch : %i Point : %i",&touch,&pointDict);
>
> CGPoint beginPoint = *(CGPoint *)CFDictionaryGetValue(aTouchSession, touch);
> NSLog(@"Fetched Touch : %i Point : %i",&touch,&beginPoint);
... where touch is (UITouch *), pointDict is CFDictionaryRef, aTouchSession is a mutable dictionary initialized to have ==>CFType<== keys and values, and beginPoint is CGPoint, all local variables.
1. You do realize that your %i's, applied to pointers to your stack variables, are just printing out the signed decimal integer representation of the addresses of those variables (assuming int and pointer are the same size on the current architecture)?
2. You do realize that the return value of CFDictionaryGetValue, with the dictionary set up as you did, will be of a CoreFoundation object, and that CGPoint is just a struct, not a Core Foundation object? In fact, you stored pointDict into it, which is a CFDictionary, not a CGPoint. Taking the CFDictionaryRef you got back from aTouchSession, and casting it to CGPoint * won't make it a pointer to a CGPoint. Try pulling the values out with CFDictionary functions.
— F
_______________________________________________
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