开发者

How to test if Binary Data value exists/been set in CoreData?

开发者 https://www.devze.com 2023-04-13 10:03 出处:网络
I have a binary data attribute in Core Data that depending on a situation gets assigned a value (its actually a voice recording) or not.

I have a binary data attribute in Core Data that depending on a situation gets assigned a value (its actually a voice recording) or not.

I need to be able to test whether its been set or not like a bool value. How would I do that?

This code works for the other objects (int values in core data) but obviously not for a Binary Data attribute.

aud开发者_如何学PythonioRecorded.text = [[[tests objectAtIndex:t] valueForKey:@"test_voice"] boolValue] ? @"YES" : @"NO";   


Ok figured it out - dead simple...realised I'm actually testing if it exists anyway duh!

audioRecorded.text = [[tests objectAtIndex:t] valueForKey:@"test_voice"] ? @"YES" : @"NO";

No need to cast it as a boolValue.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号