Casting a CFDictionaryRef to NSDictionary?

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

I have the code (stripped down):

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


        
3条回答
  •  孤城傲影
    2020-12-16 10:03

    ARC changed the way bridging works.

    NSDictionary *original = [NSDictionary dictionaryWithObject:@"World" forKey:@"Hello"];
    CFDictionaryRef dict = (__bridge CFDictionaryRef)original;
    NSDictionary *andBack = (__bridge NSDictionary*)dict;
    NSLog(@"%@", andBack);
    

提交回复
热议问题