ios - Xcode Issue Navigator says "Value stored to BOOL during its initialization is never read" -


i declared bool redguy in viewcontroller.h

in viewcontroller.m file under viewdidload method have following code...

[[nsuserdefaults standarduserdefaults] setbool:redguy forkey:@"save"];  if (redguy==[[nsuserdefaults standarduserdefaults]synchronize]) {     man.image=[uiimage imagenamed:@"red.png"]; }    bool redguy=[[nsuserdefaults standarduserdefaults]boolforkey:@"save"]; 

the above code want perfectly. however, in xcode's product --> analyze, i'm getting message in issue navigator stating...

"value stored redguy during initialization never read"

i understand it's referring me adding word bool in front of redguy, without adding it, nothing works. can ignore issue navigator message, apple reject app if do? why issue navigator saying it's never read, when works fine on devices?

you redeclaring redguy local variable not using it, reason message. end of story. there no other reason. croissant says in comment.

now say: "if don't reuse bool word, want doesn't work."

so having reuse bool word incorrect way of sorting out whatever: "what want doesn't work." is.

you don't "what want doesn't work." is. whatever problem is, re-using bool word not correct solution. can see not correct solution because getting compilation warning, if not getting warning still incorrect solution because have shadowed the redguy instance variable redguy local variable.

you say: "i know shouldn't have re-declare bool" anyway. ???!!???

open new question , describe "what want doesn't work." means , solve problem correctly problem irrelevant.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

c# - Retrieve google contact -

javascript - How to insert selected radio button value into table cell -