我的代碼(精簡):將CFDictionaryRef投射到NSDictionary?
CFDictionaryRef *currentListingRef;
//declare currentListingRef here
NSDictionary *currentListing;
currentListing = (NSDictionary *) currentListingRef;
然後我得到的錯誤:
Cast of a non-Objective-C pointer type 'CFDictionaryRef *' (aka 'const struct __CFDictionary **') to 'NSDictionary *' is disallowed with ARC
我在做什麼錯?如何將CFDictionaryRef
轉換爲NSDictionary
?
如何將這項工作的其他方式?如在中,從'cfDict'創建'myNSDictionary'? – johnluttig
我試過了:'currentListing =(__bridge NSDictionary *)currentListingRef;'並且收到了錯誤:**「不兼容的類型將'CFDictionaryRef *'(又名'const struct __CFDictionary **')轉換爲'NSDictionary *' 「** – johnluttig
更新瞭如何去雙向的答案。你的代碼的問題是你有CFDictionarRef *,CFDictionaryRef已經是一個指針類型。 –