Skip to content

Cannot initialize a parameter of type 'id<NSCopying> _Nonnull' with an rvalue of type 'Class' #28

Description

@FycGitHub

111

NSArray> *FBGetObjectStrongReferences(id obj, NSMutableDictionary> *> *layoutCache) { NSMutableArray> *array = [NSMutableArray new];

__unsafe_unretained Class previousClass = nil;
__unsafe_unretained Class currentClass = object_getClass(obj);

while (previousClass != currentClass) {
NSArray<id> *ivars;

if (layoutCache && currentClass) {
  ivars = layoutCache[currentClass];
}

if (!ivars) {
  ivars = FBGetStrongReferencesForClass(currentClass);
  if (layoutCache && currentClass) {
    layoutCache[currentClass] = ivars;
  }
}
[array addObjectsFromArray:ivars];

previousClass = currentClass;
currentClass = class_getSuperclass(currentClass);

}

return [array copy];
}

问题总结:
layoutCache[currentClass] = ivars; 这行代码报的错,注释掉就能正常编译

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions