Casting a CFDictionaryRef to NSDictionary?

后端 未结 3 734
醉话见心
醉话见心 2020-12-16 09:10

I have the code (stripped down):

CFDictionaryRef *currentListingRef;
//declare currentListingRef here
NSDictionary *currentListing;
currentListing = (NSDicti         


        
3条回答
  •  轮回少年
    2020-12-16 09:39

    In ARC, this should be done this way:

    CFDictionaryRef currentListingRef = ...;
    NSDictionary *currentListing = CFBridgingRelease(currentListingRef);
    

    This releases the CF object and transfers ownership of the object to ARC otherwise you should release CF object manually.

提交回复
热议问题