I have followed the steps to manage my own token cache when a user logs in through Facebook on my app, however it always crashes when the login button is pressed. It calls:
NSDictionary *data = [[NSDictionary alloc] initWithContentsOfFile:self.tokenFilePath];
and then crashes. If I change the initialisation of
_tokenFilePath = [self filePath];
to
self.tokenFilePath = [self filePath];
then it doesn’t crash, but then sometimes the login button has to be pressed multiple times before it logs in.
How can I fix this?
Thank you.
If you are not using ARC there is going to be a retain difference.
self.tokenFilePathcalls a setter and that setter is increasing the retain count offilePath.Without ARC assigning directly to an ivar does not increase the retain count.
Use:
With ARC the direct assignment increases the retain count.