我有一个带有 NSDictionary 的初始化程序的类:
-(id)initWithVector:(NSDictionary *) vectorDictionary;
当我尝试将其传递给 NSDictionary 时,它给了我一个错误:
将“VectorClass * _strong”发送到参数类型“NSDictionary *”的不兼容点类型
代码:
// myVectorList is an array of dictionaries
for (NSDictionary *vector in self.myFielder.myVectorList)
{
if ([vector isKindOfClass:[NSDictionary class]])
{
// hardcoded for testing purposes
if ([[vector objectForKey:HANDLE] isEqualToString:@"pt07p48u17aj75qx8n2fri9jlkrc262yt8"])
{
// GET THE WARNING ON PASSING "VECTOR"
VectorClass *vector = [[VectorClass alloc] initWithVector:vector];
[vector retrieveVectorAttributeTable];
[vector retrieveVectorMetadataTable];
}
}
}
如果我键入(NSDictionary *)向量,则没有警告。
vector 应该是字典,那为什么我会收到警告?