ios - 根据 coredata 中的属性名称获取唯一对象
<p><p>我在 coredata 中有实体employee_detail</p>
<pre><code>name | rate | factor |
_______|______|________|
John |3.2 | 4 |
Betty|5.5 | 7 |
Betty|2.1 | 2 |
Betty|3.1 | 2 |
Edward |4.5 | 5 |
John |2.3 | 4 |
</code></pre>
<p>我想要基于属性名称的唯一对象</p>
<p>O/P 应该是 </p>
<pre><code>name | rate | factor |
_______|______|________|
John |3.2 | 4 |
Betty|5.5 | 7 |
Edward |4.5 | 5 |
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>NSFetchRequest *fetchRequest = ;
NSEntityDescription *entity = ;
fetchRequest.resultType = NSDictionaryResultType;
fetchRequest.propertiesToFetch = objectForKey:@"name"]];
fetchRequest.returnsDistinctResults = YES;
NSArray *dictionaries = ;
NSLog (@"names: %@",dictionaries);
</code></pre></p>
<p style="font-size: 20px;">关于ios - 根据 coredata 中的属性名称获取唯一对象,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/30755509/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/30755509/
</a>
</p>
页:
[1]