现在的位置: 首页 > 综合 > 正文

出现警告:incompatible pointer types returning from a function with result type

2013年01月10日 ⁄ 综合 ⁄ 共 366字 ⁄ 字号 评论关闭

出现警告:incompatible pointer types returning from a function with result type的解决办法

 - (UIViewController *)masterViewController
{
if (_viewControllers && [_viewControllers count] > 0) {
NSObject *controller = [_viewControllers objectAtIndex:0];
if ([controller isKindOfClass:[UIViewController class]]) {
return [(id)[controller retain] autorelease];
}
}
return nil;
}



出现这个问题时因为返回值不匹配,这里为了不改变过多代码,这里添加一个(id)会消除警告



抱歉!评论已关闭.