1

Since I upgraded to iOS 8, I have the following lines of code :

NSNumber *balance = dict[@"user"][@"balance"];
[IWSession session].currentUser.balance = [balance integerValue];

which generate sometimes a exc_bad_access

1) This is totaly random

2) By setting a NSLog(@"%@",dict[@"user"][@"balance"]), I can tell that the value is never nil and the object type a NSNumber

3) IWSession.session is a singleton instance and the currentUser.balance is a NSInteger which is well synthetized.

Any idea of what can be wrong ?

Thanks a lot

Borys Verebskyi
  • 4,160
  • 6
  • 28
  • 42
Romain Dorange
  • 831
  • 1
  • 10
  • 23
  • Well, you could be failing fetching `currentUser` or storing into `currentUser.balance`. But if the NSNumnber `balance` is bad it's probably because it went bad inside the dictionaries, due to some sort of ARC-relates snafu. Use Zombies et al to diagnose. – Hot Licks Sep 28 '14 at 13:57
  • (I assume that the bogus `[` at the very start of your code is a typo in the post and not actually in your code.) – Hot Licks Sep 28 '14 at 13:58
  • Thanks. Yep typo Error, I just updated. currentUser is ok if I log it (everytime). The issue might be the storage of the value or as you said it, the NSNumber itself. I will go deeper in the issue. – Romain Dorange Sep 28 '14 at 14:09
  • Find my issue thanks to your suggestion of using NSZombie. Add it as an answer and I will accept it ! Thanks Romain – Romain Dorange Sep 29 '14 at 12:59
  • How were you able to fix this? – Tash Pemhiwa Jan 08 '17 at 11:34

0 Answers0