[英]ARC conversion of TPMultiLayoutViewController; Implicit conversion of an Objective-C pointer to 'const void *' is disallowed with ARC
I'm trying to use TPMultiLayoutViewController in a project using ARC, but am bumping into the following error:- 我正在尝试在使用ARC的项目中使用TPMultiLayoutViewController ,但遇到以下错误:-
Implicit conversion of an Objective-C pointer to 'const void *' is disallowed with ARC
ARC不允许将Objective-C指针隐式转换为“ const void *”
I'm really not sure how to tackle this; 我真的不确定如何解决这个问题。 does it need explicitly converting?
需要显式转换吗? and how would I do that?
我该怎么办?
- (void)addAttributesForSubviewHierarchy:(UIView*)view associatedWithSubviewHierarchy:(UIView*)associatedView toTable:(NSMutableDictionary*)table {
[table setObject:[self attributesForView:view] forKey:[NSValue valueWithPointer:associatedView]];
if ( ![self shouldDescendIntoSubviewsOfView:view] ) return;
for ( UIView *subview in view.subviews ) {
UIView *associatedSubView = (view == associatedView ? subview : [self findAssociatedViewForView:subview amongViews:associatedView.subviews]);
if ( associatedSubView ) {
[self addAttributesForSubviewHierarchy:subview associatedWithSubviewHierarchy:associatedSubView toTable:table];
}
}
}
You're getting the error because of this: 由于以下原因,您遇到了错误:
[NSValue valueWithPointer:associatedView]
Since valueWithPointer:
takes a const char *
. 由于
valueWithPointer:
需要const char *
。 You can work around this by doing what @ user1139069 suggested: 您可以通过执行@ user1139069建议的方法来解决此问题:
[NSValue valueWithPointer:(__bridge void *)associatedView]
如果您使用[NSValue valueWithNonretainedObject:]
而不是[NSValue valueWithPointer:]
怎么办?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.