Coredata number returns a number of PFCachedNumber class

自闭症网瘾萝莉.ら 提交于 2020-01-05 07:35:09

问题


Like the title says i have a one to many relationship and the many accepts numbers, and it is given an NSNumber, however when i retrieve that number back from coredata it comes in the form of a PFCachedNumber. Any thoughts on why this may be?

Thanks!

for (UserNumber *info in pinNumberArray) {

//The numbers I'm after are inside ergTimes.
        NSSet *time = [[NSSet alloc] initWithSet:info.Times];

        for (ErgTimes *ergTimes in time){
            NSLog(@"Times Class : %@", [ergTimes.Twok class]);
        }
    }     

回答1:


I wouldn't worry about it. This is a common occurrence.

NSNumber, like most common API classes, is actually a "class cluster" in which a large number of classes masquerade as a single class. For example, if you initialize an NSString as a file path, you actually get back a class dedicated to handling file paths.

I haven't seen this particular class but I presume that PF stands for "PrivateFramework" just like NS stands for "NextStep" and CF stands for "CoreFoundation". It's likely an internal class we're not supposed to see easily.

(I am amused that they spelled "cached" incorrectly.)

You test for a class cluster with a class test like so:

[pfCashedNumerObject class] == NSNumber

Class-clusters internal classes all identify as the same public class.



来源:https://stackoverflow.com/questions/6284470/coredata-number-returns-a-number-of-pfcachednumber-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!