Xcode warning “Property access results unused - getters should not be used for side effects”

后端 未结 4 1070
时光说笑
时光说笑 2021-02-01 00:31

I\'m getting this warning when I\'m calling a local routine.

My code is this:

-(void)nextLetter {
    // NSLog(@\"%s\", __FUNCTION__);
    currentLetter          


        
4条回答
  •  盖世英雄少女心
    2021-02-01 00:55

    You're declaring fetchLetter using syntax like this?

    @property (retain) id fetchLetter;
    

    That looks wrong for what you're doing. Properties are intended to be variable accessors that (in the case of getters) don't have any side effects.

    You should declare fetchLetter as a method, like so:

    - (void) fetchLetter;
    

    and access it using:

    [self fetchLetter]
    

提交回复
热议问题