iOS bridge vs bridge_transfer

后端 未结 4 1539
旧巷少年郎
旧巷少年郎 2021-01-31 03:27

I\'m confused with bridge and bridge_transfer, is this correct?

-(void)getData{
    ABAddressBookRef addressBook = ABAddressBookCreate(         


        
4条回答
  •  春和景丽
    2021-01-31 03:47

    Luis Oscar I'm still working out my understanding of ARC, but I believe addressBook does need CFRelease. ARC is not managing addressBook. NSArray *allPeople is being managed by ARC via the __bridge_transfer cast hint and it is being created as a copy of the original. Without the CFRelease, addressBook will leak.

提交回复
热议问题