English 中文(简体)
利用国家数据库搜索核心数据实体的NSArray属性
原标题:Using NSPredicate to search NSArray attribute of core data entity

我深入细致地寻找解决这一问题的办法。 我的所有尝试都产生了零结果。 这里是一般数据结构:

Core Data Entity A {
  stringAttribute string
  ....
  transformableAttribute(NSArray of NSString objects) keywords
}

关键词 = [NSArray阵列WithObjects:@“string 1”,@“string 2”,@“string 3”,nil]

I m试图开一个前线,搜索可变特性。

我对A实体进行了以下审判。 核心数据储存是一只油罐。

NSString *term = @"string 1";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY keywords like[cd] %@", term];

页: 1

NSArray *termArray = [NSArray arrayWithObject:@"string 1"];
NSPredicate *predicate = [NSPredicate predicateWithFormat@"ANY keywords in %@", termArray];

页: 1

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(keywords, $x, $x like %@).@count > 0", term]

——> 一种错误的结果,即:非相互关系不能成为分局收集

我曾尝试过上述一些变化,但至今没有结果。 任何建议? 是否可能有核心数据?

感谢!

问题回答

我不使用<代码>可转换成,这是我已经输入的核心数据的一项内容,但如果我记得你可以依据这些数据。 (如果我错了,请有人打电话给我)

但是,当我看到你的<代码>可转换成array of string。 我只想说<代码>你想要一个数据库中一个阵列吗?

为什么不建立关系? 如果您的阵列能够有不同数目的扼杀,那么这种关系就存在。

核心数据是数据库的抽象,在不使用阵列的行文中,你使用表格。 这将可能简化你的生活,使你能够et。





相关问题
Asynchronous request to the server from background thread

I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...

objective-c: Calling a void function from another controller

i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...

NSMutableArray values becoming "invalid"

I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...

iPhone numberpad with decimal point

I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...

热门标签