开发者

Is there an tutorial that shows how attribute validation works in Core Data?

开发者 https://www.devze.com 2023-01-02 22:50 出处:网络
I\'d like to play around with attribute value validation, but the documentation is pretty empty on this. Maybe there\'s an good article or tutorial 开发者_StackOverflow中文版out there?Here is a fairly

I'd like to play around with attribute value validation, but the documentation is pretty empty on this. Maybe there's an good article or tutorial 开发者_StackOverflow中文版out there?


Here is a fairly common validation to ensure you don't get nonsensical dates put into a timeStamp.

- (BOOL)validateTimeStamp:(id *)valueRef error:(NSError **)outError 
{
    NSDate *testDate=(NSDate *) valueRef;
    if ([testDate compare:self.minimumTimeStamp]==NSOrderedAscending) {
        // generate and return error so you can set a proper date
    }
    return YES;
}
0

精彩评论

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