Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YYSYNTH_DYNAMIC_PROPERTY_CTYPE的getter返回值类型错误 #53

Open
dev-zlcode opened this issue Jul 17, 2018 · 1 comment
Open

YYSYNTH_DYNAMIC_PROPERTY_CTYPE的getter返回值类型错误 #53

dev-zlcode opened this issue Jul 17, 2018 · 1 comment

Comments

@dev-zlcode
Copy link

dev-zlcode commented Jul 17, 2018

#ifndef YYSYNTH_DYNAMIC_PROPERTY_CTYPE
#define YYSYNTH_DYNAMIC_PROPERTY_CTYPE(_getter_, _setter_, _type_) \
- (void)_setter_ : (_type_)object { \
    [self willChangeValueForKey:@#_getter_]; \
    NSValue *value = [NSValue value:&object withObjCType:@encode(_type_)]; \
    objc_setAssociatedObject(self, _cmd, value, OBJC_ASSOCIATION_RETAIN); \
    [self didChangeValueForKey:@#_getter_]; \
} \
- (type)_getter_ { \
    _type_ cValue = { 0 }; \
    NSValue *value = objc_getAssociatedObject(self, @selector(_setter_:)); \
    [value getValue:&cValue]; \
    return cValue; \
}
#endif

_getter_的返回值应该是_type_
@rollingstoneW
Copy link

把(type)getter改成(type)_getter_就好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants