gpt4 book ai didi

iphone - 'NSInvalidArgumentException',原因 : 'Unable to parse the format string "title contains[cd] @ %"' Error

转载 作者:行者123 更新时间:2023-11-28 20:36:11 25 4
gpt4 key购买 nike

我正在尝试创建谓词,但出现错误。我收到错误“NSInvalidArgumentException”,原因:“无法解析格式字符串“title contains[cd] @%””我试过这样:

request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]];
NSString *predicateString=[NSString stringWithFormat:@"title contains[cd] @% ",searchText];
request.predicate = [NSPredicate predicateWithFormat:predicateString];//error here

像这样

request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]];
request.predicate = [NSPredicate predicateWithFormat:@"title contains[cd] @%",searchText];//error here

最佳答案

你的意思是 %@,而不是 @%,作为对象的格式说明符。

关于iphone - 'NSInvalidArgumentException',原因 : 'Unable to parse the format string "title contains[cd] @ %"' Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10430849/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com