How to convert NSManagedObject to NSDictionary
问题 I am trying to convert NSManagedObject to NSDictionary this is what I tried: var keys:NSArray = order?.entity.attributesByName.keys var dict:NSDictionary = order?.dictionaryWithValuesForKeys(keys) But I get error: LazyForwardCollection<MapCollectionView<Dictionary<NSObject, AnyObject>, NSObject>>? is not convertible to NSArray. What am I doing wrong here? 回答1: The keys property of a dictionary returns a LazyForwardCollection which has to be converted to a real array. Another problem is that