Search code examples
iosobjective-cjailbreaktheos

Semantic Issue: Type of property does not match type of accessor


I'm currently using the theos with iOS 10 SDK trying to develop my tweak. I'm trying to make an NSString a property, and then to synthesize it . Now, I came across this: "Semantic Issue: type of property 'systemVersion' does not match type of accessor 'setSystemVersion:'"

Here is my code

    @interface ALDevice : NSObject
{
    NSString *_systemVersion;
}
@property(readonly, nonatomic) NSString *systemVersion;
- (void)setSystemVersion:(id)arg1;
@end

@implementation ALDevice
@synthesize systemVersion = _systemVersion;
- (void)setSystemVersion:(id)arg1{
    //something
}

ERROR:

./ALDevice.h:13:42: error: type of property 'systemVersion' does not match type of accessor 'setSystemVersion:' [-Werror]
@property(readonly, nonatomic) NSString *systemVersion;
                                         ^
./ALDevice.h:19:1: note: declared here
- (void)setSystemVersion:(id)arg1;

Anyone know how to fix this? thanks


Solution

  • As _systemVersion is a readonly property, it's throwing the error, please user strong instead.

    @interface ALDevice : NSObject
    {
        NSString *_systemVersion;
    }
    @property(strong, nonatomic) NSString *systemVersion;
    - (void)setSystemVersion:(id)arg1;
    @end