开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜