Je le code (dépouillé):Casting un CFDictionaryRef à NSDictionary?
CFDictionaryRef *currentListingRef;
//declare currentListingRef here
NSDictionary *currentListing;
currentListing = (NSDictionary *) currentListingRef;
Et puis-je obtenir l'erreur:
Cast of a non-Objective-C pointer type 'CFDictionaryRef *' (aka 'const struct __CFDictionary **') to 'NSDictionary *' is disallowed with ARC
Qu'est-ce que je fais mal? Comment convertir un CFDictionaryRef
en un NSDictionary
?
Comment cela fonctionnerait dans l'autre sens? Comme dans, faites 'myNSDictionary' à partir de 'cfDict'? – johnluttig
J'ai essayé: 'currentListing = (__bridge NSDictionary *) currentListingRef;' et a reçu l'erreur de: ** "Types incompatibles transtypant 'CFDictionaryRef *' (alias 'const struct __CFDictionary **') en 'NSDictionary *' avec une distribution __bridge "** – johnluttig
mis à jour la réponse avec comment aller dans les deux sens. Le problème avec votre code est que vous avez CFDictionarRef *, CFDictionaryRef est déjà un type de pointeur. –