Xcode 显示有关 unsafe_unretained 的警告,但不确定如何解决此问题

Xcode is showing a warning about unsafe_unretained and not sure on how to fix this

    MDRadialProgressTheme *newTheme = [[MDRadialProgressTheme alloc] init];
    newTheme.completedColor = [UIColor whiteColor];
    newTheme.incompletedColor =[UIColor darkGrayColor]; //[UIColor colorWithRed:177/255.0 green:179/255.0 blue:181/255.0 alpha:1.0];
    newTheme.centerColor = [UIColor clearColor];
    //newTheme.centerColor = [UIColor colorWithRed:219/255.0f green:220/255.0f blue:221.0 alpha:1.0f];
    newTheme.sliceDividerHidden = YES;
    newTheme.labelColor = [UIColor blackColor];
    newTheme.labelShadowColor = [UIColor whiteColor];

    CGRect frame = CGRectMake(0,0, 45, 45);

    radialView = [[MDRadialProgressView alloc] initWithFrame:frame andTheme:newTheme]; // warning here
    // Assigning retained object to unsafe_unretained variable; object will be released after assignment

    radialView.center=CGPointMake(self.bounds.size.width / 2.0f, self.bounds.size.width / 2.0f);
    radialView.progressTotal = 4;
    radialView.clockwise =YES;
    radialView.label.hidden =YES;
    radialView.progressCounter = 1;
    [self addSubview:radialView];

我在行 radialView = [[MDRadialProgressView 上收到一条警告说 Assigning retained object to unsafe_unretained variable; object赋值后会释放

这是什么意思,我该如何解决?


 @property (nonatomic,assign) MDRadialProgressView *radialView;

radialView 在 header 中声明(见上文)

将您的 属性 更改为

@property (nonatomic, strong) MDRadialProgressView *radialView;