iOS Core Data encryption using NSValueTransformer

这一生的挚爱 提交于 2019-12-04 14:02:04

I finally figured it out... I was confused as to what type very object had to be and what my nsvaluetransformer had to return. I wasnt casting the value to the proper type in the nsvaluetransformer and thus I was returning nil in the code. However it wasnt crashing in a way that I would easily figure this out. Secondly I changed the entity column back to an NSObject. Returned an NSData object in the transformedValue method and a NSString in the reverseTransformedValue method. This was actually all i needed to make it work. Thanks a lot for your help. It indeed was a type error.

To help anyone who would like to see the corrected code sample, replace the return line of transformedValue() in the question with this: return base64cryptString.dataUsingEncoding(NSUTF8StringEncoding)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!