Macos Mac OS X中缺少NSEntityDescription SetCompoundIndex

Macos Mac OS X中缺少NSEntityDescription SetCompoundIndex,macos,cocoa,core-data,Macos,Cocoa,Core Data,我缺少方法 复合指数 集合复合索引 在Mac OS X 10.7 SDK的N实体描述中。但是,它可以在iOS5.0 SDK中获得 另一方面,Xcode非常了解复合索引,即使在Mac OS X下也是如此。它创建了如下xcdatamodels: <entity name="OHLCV" parentEntity="Sample" syncable="YES"> <attribute name="close" attributeType="Double" defaultVal

我缺少方法

复合指数 集合复合索引 在Mac OS X 10.7 SDK的N实体描述中。但是,它可以在iOS5.0 SDK中获得

另一方面,Xcode非常了解复合索引,即使在Mac OS X下也是如此。它创建了如下xcdatamodels:

<entity name="OHLCV" parentEntity="Sample" syncable="YES">
    <attribute name="close" attributeType="Double" defaultValueString="0.0" syncable="YES"/>
    <attribute name="high" attributeType="Double" defaultValueString="0.0" syncable="YES"/>
    <attribute name="low" attributeType="Double" defaultValueString="0.0" syncable="YES"/>
    <attribute name="open" attributeType="Double" defaultValueString="0.0" syncable="YES"/>
    <attribute name="volume" attributeType="Integer 64" defaultValueString="0" syncable="YES"/>
    <compoundIndexes>
        <compoundIndex>
            <index value="open"/>
            <index value="close"/>
        </compoundIndex>
    </compoundIndexes>
</entity>
苹果会不会忘记在macapi中包含方法声明

以下是文件:

Mac:这里缺少管理复合索引的部分


iOS:

我已经通过声明调用了未声明的方法,我自己需要声明它,以便编译器接受它:

@interface NSEntityDescription ()
- (void)setCompoundIndexes:(NSArray*)anArray;
@end
在稍后的代码中,我以编程方式创建NSManagedObjectModel,我可以调用它:

[entity setCompoundIndexes:
    [NSArray arrayWithObjects:[NSArray arrayWithObjects:@"open", @"close", nil], nil]
];
我认为苹果刚刚忘记将这些方法放入CoreDataAPI。该功能在Mac OS X上也绝对可用,否则Xcode不会在xcdatamodel建模工具中提供UI

我可以进一步确认上述语句是否有效,因为我在sqlite3数据库中找到了CoreData创建的相应复合索引:

CREATE INDEX ZOHLCV_ZOPEN_ZCLOSE ON ZOHLV (ZOPEN, ZCLOSE);