1
votes

I'm trying to use TPMultiLayoutViewController in a project using ARC, but am bumping into the following error:-

Implicit conversion of an Objective-C pointer to 'const void *' is disallowed with ARC

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];
        }
    }
}
2
the first one in the method [table setObject:[self attributesForView:view] forKey:[NSValue valueWithPointer:associatedView]];akbsteam
its this part in particular [NSValue valueWithPointer:associatedView]akbsteam
Why not put the associatedView directly into the NSDictionary?mmmmmm
In general (__bridge void *) however I don't understand why you would get that error there. setObject:forKey should take iduser1139069
Can you use a view object as a key?akbsteam

2 Answers

5
votes

You're getting the error because of this:

[NSValue valueWithPointer:associatedView]

Since valueWithPointer: takes a const char *. You can work around this by doing what @ user1139069 suggested:

[NSValue valueWithPointer:(__bridge void *)associatedView]
0
votes

What if you use [NSValue valueWithNonretainedObject:] instead of [NSValue valueWithPointer:]?